Package org.apache.openjpa.jdbc.meta
Class ClassMapping
- java.lang.Object
-
- org.apache.openjpa.meta.Extensions
-
- org.apache.openjpa.meta.ClassMetaData
-
- org.apache.openjpa.jdbc.meta.ClassMapping
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<ClassMetaData>
,ClassStrategy
,Strategy
,ValueListener
,SourceTracker
,Commentable
,MetaDataContext
,MetaDataModes
public class ClassMapping extends ClassMetaData implements ClassStrategy
Specialization of metadata for relational databases.- Author:
- Abe White
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ClassMapping[]
EMPTY_MAPPINGS
-
Fields inherited from class org.apache.openjpa.meta.ClassMetaData
ACCESS_EXPLICIT, ACCESS_FIELD, ACCESS_PROPERTY, ACCESS_UNKNOWN, DEFAULT_STRING, ID_APPLICATION, ID_DATASTORE, ID_UNKNOWN, SYNTHETIC
-
Fields inherited from class org.apache.openjpa.meta.Extensions
OPENJPA
-
Fields inherited from interface org.apache.openjpa.lib.xml.Commentable
EMPTY_COMMENTS
-
Fields inherited from interface org.apache.openjpa.meta.MetaDataModes
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERY
-
Fields inherited from interface org.apache.openjpa.lib.meta.SourceTracker
SRC_ANNOTATIONS, SRC_OTHER, SRC_XML
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ClassMapping(java.lang.Class type, MappingRepository repos)
Constructor.protected
ClassMapping(ValueMetaData vmd)
Embedded constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FieldMapping
addDeclaredFieldMapping(java.lang.String name, java.lang.Class type)
Convenience method to perform cast fromClassMetaData.addDeclaredField(java.lang.String, java.lang.Class<?>)
.Joinable
assertJoinable(Column col)
Return the joinable for the given column, or throw an exception if none is available.protected void
clearDefinedFieldCache()
Clear defined field data.void
clearMapping()
Clear mapping information, including strategy.protected void
clearSubclassCache()
Clear cached subclass data.void
copy(ClassMetaData cls)
Copy the metadata from the given instance to this one.void
customDelete(OpenJPAStateManager sm, JDBCStore store)
Override this method to customize flushing this mapping.void
customInsert(OpenJPAStateManager sm, JDBCStore store)
Override this method to customize flushing this mapping.ResultObjectProvider
customLoad(JDBCStore store, boolean subclasses, JDBCFetchConfiguration fetch, long startIdx, long endIdx)
Implement this method to customize obtaining a result containing all instances of this class.boolean
customLoad(OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Result result)
Implement this method to customize loading from aResult
into an instance.boolean
customLoad(OpenJPAStateManager sm, JDBCStore store, PCState state, JDBCFetchConfiguration fetch)
Implement this method to load the state of a given object, without a previousResult
.void
customUpdate(OpenJPAStateManager sm, JDBCStore store)
Override this method to customize flushing this mapping.void
delete(OpenJPAStateManager sm, JDBCStore store, RowManager rm)
Set the where values appropriately to delete the proper instance, and set all relations on non-secondary tables as updates.java.lang.String
getAlias()
Return the alias of this strategy.ColumnIO
getColumnIO()
I/O information on the key columns / join key.FieldMapping
getDeclaredFieldMapping(int index)
Convenience method to perform cast fromClassMetaData.getDeclaredField(int)
.FieldMapping
getDeclaredFieldMapping(java.lang.String name)
Convenience method to perform cast fromClassMetaData.getDeclaredField(int)
.FieldMapping[]
getDeclaredFieldMappings()
Convenience method to perform cast fromClassMetaData.getDeclaredFields()
.FieldMapping[]
getDeclaredUnmanagedFieldMappings()
Convenience method to perform cast fromClassMetaData.getDeclaredUnmanagedFields()
.FieldMapping[]
getDefaultFetchGroupFieldMappings()
Convenience method to perform cast fromClassMetaData.getDefaultFetchGroupFields()
.FieldMapping[]
getDefinedFieldMappings()
Convenience method to perform cast fromClassMetaData.getDefinedFields()
.FieldMapping[]
getDefinedFieldMappingsInListingOrder()
Convenience method to perform cast fromClassMetaData.getDefinedFieldsInListingOrder()
.Discriminator
getDiscriminator()
The class discriminator.ValueMapping
getEmbeddingMapping()
Convenience method to perform cast fromClassMetaData.getEmbeddingMetaData()
FieldMapping
getFieldMapping(int index)
Convenience method to perform cast fromClassMetaData.getField(int)
.FieldMapping
getFieldMapping(java.lang.String name)
Convenience method to perform cast fromClassMetaData.getField(int)
.FieldMapping[]
getFieldMappings()
Convenience method to perform cast fromClassMetaData.getFields()
.FieldMapping[]
getFieldMappingsInListingOrder()
Convenience method to perform cast fromClassMetaData.getFieldsInListingOrder()
.ClassMapping[]
getIndependentAssignableMappings()
Returns the closest-derived list of non-inter-joinable mapped types assignable to this type.Joinable
getJoinable(Column col)
Return theJoinable
for the given column.ClassMapping[]
getJoinablePCSubclassMappings()
Return mapped subclasses that are reachable via joins.ClassMapping
getJoinablePCSuperclassMapping()
Return the nearest mapped superclass that can join to this class.ForeignKey
getJoinForeignKey()
Foreign key linking the primary key columns to the superclass table, or null if none.ClassMapping[]
getMappedPCSubclassMappings()
Convenience method to perform cast fromClassMetaData.getMappedPCSubclassMetaDatas()
.ClassMapping
getMappedPCSuperclassMapping()
Convenience method to perform cast fromClassMetaData.getMappedPCSuperclassMetaData()
.ClassMappingInfo
getMappingInfo()
Raw mapping data.MappingRepository
getMappingRepository()
Convenience method to perform cast fromClassMetaData.getRepository()
.java.lang.Object
getObjectId(JDBCStore store, Result res, ForeignKey fk, boolean subs, Joins joins)
Return the oid value stored in the result.ClassMapping[]
getPCSubclassMappings()
Convenience method to perform cast fromClassMetaData.getPCSubclassMetaDatas()
.ClassMapping
getPCSuperclassMapping()
Convenience method to perform cast fromClassMetaData.getPCSuperclassMetaData()
.Column[]
getPrimaryKeyColumns()
The columns this mapping uses to uniquely identify an object.FieldMapping[]
getPrimaryKeyFieldMappings()
Convenience method to perform cast fromClassMetaData.getPrimaryKeyFields()
.ClassStrategy
getStrategy()
The strategy used to map this mapping.int
getSubclassFetchMode()
The subclass fetch mode, as one of the eager constants inJDBCFetchConfiguration
.Table
getTable()
The mapping's primary table.Version
getVersion()
The version indicator.FieldMapping
getVersionFieldMapping()
Convenience method to perform cast fromClassMetaData.getVersionField()
.void
initialize()
Perform caching and other initialization operations.protected void
initializeMapping()
Initialize mapping.void
insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm)
Set values for the mapping into the proper rows.java.lang.Boolean
isCustomDelete(OpenJPAStateManager sm, JDBCStore store)
ReturnBoolean.FALSE
if this mapping does not customize the delete process,Boolean.TRUE
if it does, or null if it does customize the delete, but also relies on the standard delete method being called.java.lang.Boolean
isCustomInsert(OpenJPAStateManager sm, JDBCStore store)
ReturnBoolean.FALSE
if this mapping does not customize the insert process,Boolean.TRUE
if it does, or null if it does customize the insert, but also relies on the standard insert method being called.java.lang.Boolean
isCustomUpdate(OpenJPAStateManager sm, JDBCStore store)
ReturnBoolean.FALSE
if this mapping does not customize the update process,Boolean.TRUE
if it does, or null if it does customize the update, but also relies on the standard update method being called.java.lang.Boolean
isForeignKeyObjectId(ForeignKey fk)
Return whether the columns of the given foreign key to this mapping can be used to construct an object id for this type.boolean
isMapped()
Returns true if this class does not use the "none" strategy (including if it has a null strategy, and therefore is probably in the process of being mapped).boolean
isPrimaryKeyObjectId(boolean hasAll)
Return true if the this class' primary key columns correspond to the base class' primary key columns used to construct oid values.boolean
isVerticalStrategy()
Joins
joinSuperclass(Joins joins, boolean toThis)
Join the mapping and its superclass.void
map(boolean adapt)
Map the owning mapping using this strategy.void
refSchemaComponents()
protected void
resolveMapping(boolean runtime)
Resolve mapping data.void
setClassMapping(ClassMapping owner)
Set the class mapping using this strategy.void
setColumnIO(ColumnIO io)
I/O information on the key columns / join key.protected void
setDescribedType(java.lang.Class type)
Set the class described by this metadata.void
setJoinable(Column col, Joinable joinable)
Add the given column-to-joinable mapping.void
setJoinForeignKey(ForeignKey fk)
Foreign key linking the primary key columns to the superclass table, or null if none.void
setPrimaryKeyColumns(Column[] cols)
The columns this mapping uses to uniquely identify an object.void
setStrategy(ClassStrategy strategy, java.lang.Boolean adapt)
The strategy used to map this mapping.void
setSubclassFetchMode(int mode)
The subclass fetch mode, as one of the eager constants inJDBCFetchConfiguration
.void
setTable(Table table)
The mapping's primary table.boolean
supportsEagerSelect(Select sel, OpenJPAStateManager sm, JDBCStore store, ClassMapping base, JDBCFetchConfiguration fetch)
Return true if this strategy can perform the given select from the givenbase
mapping.void
syncMappingInfo()
UpdateMappingInfo
with our current mapping information.java.lang.Object
toDataStoreValue(java.lang.Object obj, Column[] cols, JDBCStore store)
Return the given column value(s) for the given object.void
update(OpenJPAStateManager sm, JDBCStore store, RowManager rm)
Set values for the mapping into the proper rows.protected boolean
validateDataStoreExtensionPrefix(java.lang.String prefix)
Return true if extensions starting with the given official datastore prefix should be validated for this runtime.-
Methods inherited from class org.apache.openjpa.meta.ClassMetaData
addDeclaredFetchGroup, addDeclaredField, addDeclaredInterface, addDefinedSuperclassField, addExtensionKeys, clearAllFieldCache, clearFieldCache, compareTo, defineSuperclassFields, equals, getAccessType, getCacheEnabled, getColNumber, getComments, getCustomFetchGroups, getDataCache, getDataCacheEnabled, getDataCacheName, getDataCacheTimeout, getDeclaredFetchGroups, getDeclaredField, getDeclaredField, getDeclaredFieldNames, getDeclaredFields, getDeclaredInterfaces, getDeclaredUnmanagedFields, getDefaultFetchGroupFields, getDefinedFields, getDefinedFieldsInListingOrder, getDefinedSuperclassField, getDescribedType, getDescribedTypeString, getDetachedState, getDetachedStateField, getEmbeddingMetaData, getEnvClassLoader, getExtraFieldDataIndex, getExtraFieldDataLength, getFetchGroup, getField, getField, getFieldNames, getFields, getFieldsInListingOrder, getIdClass, getIdentitySequenceMetaData, getIdentitySequenceName, getIdentityStrategy, getIdentityType, getInterfaceAliasedProperties, getInterfaceImpl, getInterfacePropertyAlias, getLifecycleMetaData, getLineNumber, getListingIndex, getLrsFields, getMappedPCSubclassMetaDatas, getMappedPCSuperclassMetaData, getMappyedByIdFields, getObjectIdType, getPCSubclasses, getPCSubclassMetaDatas, getPCSuperclass, getPCSuperclassMetaData, getPkAndNonPersistentManagedFmdIndexes, getPrimaryKeyFields, getProxyFields, getRepository, getRequiresExtent, getResolve, getResourceName, getSourceFile, getSourceMode, getSourceName, getSourceScope, getSourceType, getSuperclassField, getTypeAlias, getUseSchemaElement, getVersionField, hasAbstractPKField, hashCode, hasInverseManagedFields, hasPKFieldsFromAbstractClass, isAbstract, isAccessibleField, isDetachable, isEmbeddable, isEmbeddedOnly, isExplicitAccess, isIntercepting, isManagedInterface, isMixedAccess, isObjectIdTypeShared, isOpenJPAIdentity, registerForValueUpdate, removeDeclaredFetchGroup, removeDeclaredField, removeDeclaredInterface, removeDefinedSuperclassField, resolve, resolveMeta, setAbstract, setAccessType, setCacheEnabled, setColNumber, setComments, setDataCacheName, setDataCacheTimeout, setDetachable, setDetachedState, setEmbeddable, setEmbeddedOnly, setEnvClassLoader, setIdentitySequenceName, setIdentityStrategy, setIdentityType, setIntercepting, setInterfaceImpl, setInterfacePropertyAlias, setLineNumber, setListingIndex, setManagedInterface, setObjectIdType, setPCSuperclass, setPCSuperclassMetaData, setRequiresExtent, setResolve, setResolve, setSource, setSourceMode, setSourceMode, setTypeAlias, setUseSchemaElement, toString, useIdClassFromParent, usesDetachedState, validateMapping, validateMeta, valueChanged
-
Methods inherited from class org.apache.openjpa.meta.Extensions
addExtension, addExtension, copy, getBooleanExtension, getBooleanExtension, getDoubleExtension, getDoubleExtension, getEmbeddedExtensions, getEmbeddedExtensions, getExtensionKeys, getExtensionKeys, getExtensionVendors, getIntExtension, getIntExtension, getObjectExtension, getObjectExtension, getStringExtension, getStringExtension, hasExtension, hasExtension, isEmpty, removeEmbeddedExtensions, removeEmbeddedExtensions, removeExtension, removeExtension, validateExtensionKeys
-
-
-
-
Field Detail
-
EMPTY_MAPPINGS
public static final ClassMapping[] EMPTY_MAPPINGS
-
-
Constructor Detail
-
ClassMapping
protected ClassMapping(java.lang.Class type, MappingRepository repos)
Constructor. Supply described type and owning repository.
-
ClassMapping
protected ClassMapping(ValueMetaData vmd)
Embedded constructor. Supply embedding value and owning repository.
-
-
Method Detail
-
getDiscriminator
public Discriminator getDiscriminator()
The class discriminator.
-
getVersion
public Version getVersion()
The version indicator.
-
getObjectId
public java.lang.Object getObjectId(JDBCStore store, Result res, ForeignKey fk, boolean subs, Joins joins) throws java.sql.SQLException
Return the oid value stored in the result. This implementation will recurse until it finds an ancestor class who uses oid values for its primary key.- Parameters:
fk
- if non-null, use the local columns of the given foreign key in place of this class' primary key columns- Throws:
java.sql.SQLException
- See Also:
isPrimaryKeyObjectId(boolean)
-
toDataStoreValue
public java.lang.Object toDataStoreValue(java.lang.Object obj, Column[] cols, JDBCStore store)
Return the given column value(s) for the given object. The given columns will be primary key columns of this mapping, but may be in any order. If there is only one column, return its value. If there are multiple columns, return an object array of their values, in the same order the columns are given.
-
assertJoinable
public Joinable assertJoinable(Column col)
Return the joinable for the given column, or throw an exception if none is available.
-
getJoinable
public Joinable getJoinable(Column col)
Return theJoinable
for the given column. Any column that another mapping joins to must be controlled by a joinable.
-
setJoinable
public void setJoinable(Column col, Joinable joinable)
Add the given column-to-joinable mapping.
-
isForeignKeyObjectId
public java.lang.Boolean isForeignKeyObjectId(ForeignKey fk)
Return whether the columns of the given foreign key to this mapping can be used to construct an object id for this type. This is a relatively expensive operation; its results should be cached.- Returns:
Boolean.TRUE
if the foreign key contains all oid columns,null
if it contains only some columns, orBoolean.FALSE
if it contains non-oid columns
-
getMappingInfo
public ClassMappingInfo getMappingInfo()
Raw mapping data.
-
getStrategy
public ClassStrategy getStrategy()
The strategy used to map this mapping.
-
setStrategy
public void setStrategy(ClassStrategy strategy, java.lang.Boolean adapt)
The strategy used to map this mapping. Theadapt
parameter determines whether to adapt when mapping the strategy; use null if the strategy should not be mapped.
-
getTable
public Table getTable()
The mapping's primary table.
-
setTable
public void setTable(Table table)
The mapping's primary table.
-
getPrimaryKeyColumns
public Column[] getPrimaryKeyColumns()
The columns this mapping uses to uniquely identify an object. These will typically be the primary key columns or the columns this class uses to link to its superclass table.
-
setPrimaryKeyColumns
public void setPrimaryKeyColumns(Column[] cols)
The columns this mapping uses to uniquely identify an object. These will typically be the primary key columns or the columns this class uses to link to its superclass table.
-
getColumnIO
public ColumnIO getColumnIO()
I/O information on the key columns / join key.
-
setColumnIO
public void setColumnIO(ColumnIO io)
I/O information on the key columns / join key.
-
getJoinForeignKey
public ForeignKey getJoinForeignKey()
Foreign key linking the primary key columns to the superclass table, or null if none.
-
setJoinForeignKey
public void setJoinForeignKey(ForeignKey fk)
Foreign key linking the primary key columns to the superclass table, or null if none.
-
refSchemaComponents
public void refSchemaComponents()
-
clearMapping
public void clearMapping()
Clear mapping information, including strategy.
-
syncMappingInfo
public void syncMappingInfo()
UpdateMappingInfo
with our current mapping information.
-
setDescribedType
protected void setDescribedType(java.lang.Class type)
Description copied from class:ClassMetaData
Set the class described by this metadata. The type may be reset when an embedded value changes its declared type.- Overrides:
setDescribedType
in classClassMetaData
-
getSubclassFetchMode
public int getSubclassFetchMode()
The subclass fetch mode, as one of the eager constants inJDBCFetchConfiguration
.
-
setSubclassFetchMode
public void setSubclassFetchMode(int mode)
The subclass fetch mode, as one of the eager constants inJDBCFetchConfiguration
.
-
getMappingRepository
public MappingRepository getMappingRepository()
Convenience method to perform cast fromClassMetaData.getRepository()
.
-
getEmbeddingMapping
public ValueMapping getEmbeddingMapping()
Convenience method to perform cast fromClassMetaData.getEmbeddingMetaData()
-
isMapped
public boolean isMapped()
Returns true if this class does not use the "none" strategy (including if it has a null strategy, and therefore is probably in the process of being mapped).- Overrides:
isMapped
in classClassMetaData
-
getPCSuperclassMapping
public ClassMapping getPCSuperclassMapping()
Convenience method to perform cast fromClassMetaData.getPCSuperclassMetaData()
.
-
getMappedPCSuperclassMapping
public ClassMapping getMappedPCSuperclassMapping()
Convenience method to perform cast fromClassMetaData.getMappedPCSuperclassMetaData()
.
-
getJoinablePCSuperclassMapping
public ClassMapping getJoinablePCSuperclassMapping()
Return the nearest mapped superclass that can join to this class.
-
getPCSubclassMappings
public ClassMapping[] getPCSubclassMappings()
Convenience method to perform cast fromClassMetaData.getPCSubclassMetaDatas()
.
-
getMappedPCSubclassMappings
public ClassMapping[] getMappedPCSubclassMappings()
Convenience method to perform cast fromClassMetaData.getMappedPCSubclassMetaDatas()
.
-
getJoinablePCSubclassMappings
public ClassMapping[] getJoinablePCSubclassMappings()
Return mapped subclasses that are reachable via joins.
-
getIndependentAssignableMappings
public ClassMapping[] getIndependentAssignableMappings()
Returns the closest-derived list of non-inter-joinable mapped types assignable to this type. May return this mapping.
-
getFieldMappings
public FieldMapping[] getFieldMappings()
Convenience method to perform cast fromClassMetaData.getFields()
.
-
getDeclaredFieldMappings
public FieldMapping[] getDeclaredFieldMappings()
Convenience method to perform cast fromClassMetaData.getDeclaredFields()
.
-
getPrimaryKeyFieldMappings
public FieldMapping[] getPrimaryKeyFieldMappings()
Convenience method to perform cast fromClassMetaData.getPrimaryKeyFields()
.
-
getVersionFieldMapping
public FieldMapping getVersionFieldMapping()
Convenience method to perform cast fromClassMetaData.getVersionField()
.
-
getDefaultFetchGroupFieldMappings
public FieldMapping[] getDefaultFetchGroupFieldMappings()
Convenience method to perform cast fromClassMetaData.getDefaultFetchGroupFields()
.
-
getDefinedFieldMappings
public FieldMapping[] getDefinedFieldMappings()
Convenience method to perform cast fromClassMetaData.getDefinedFields()
.
-
getFieldMappingsInListingOrder
public FieldMapping[] getFieldMappingsInListingOrder()
Convenience method to perform cast fromClassMetaData.getFieldsInListingOrder()
.
-
getDefinedFieldMappingsInListingOrder
public FieldMapping[] getDefinedFieldMappingsInListingOrder()
Convenience method to perform cast fromClassMetaData.getDefinedFieldsInListingOrder()
.
-
getFieldMapping
public FieldMapping getFieldMapping(int index)
Convenience method to perform cast fromClassMetaData.getField(int)
.
-
getDeclaredFieldMapping
public FieldMapping getDeclaredFieldMapping(int index)
Convenience method to perform cast fromClassMetaData.getDeclaredField(int)
.
-
getFieldMapping
public FieldMapping getFieldMapping(java.lang.String name)
Convenience method to perform cast fromClassMetaData.getField(int)
.
-
getDeclaredFieldMapping
public FieldMapping getDeclaredFieldMapping(java.lang.String name)
Convenience method to perform cast fromClassMetaData.getDeclaredField(int)
.
-
getDeclaredUnmanagedFieldMappings
public FieldMapping[] getDeclaredUnmanagedFieldMappings()
Convenience method to perform cast fromClassMetaData.getDeclaredUnmanagedFields()
.
-
addDeclaredFieldMapping
public FieldMapping addDeclaredFieldMapping(java.lang.String name, java.lang.Class type)
Convenience method to perform cast fromClassMetaData.addDeclaredField(java.lang.String, java.lang.Class<?>)
.
-
resolveMapping
protected void resolveMapping(boolean runtime)
Description copied from class:ClassMetaData
Resolve mapping data. Logs resolve message and resolves super by default.- Overrides:
resolveMapping
in classClassMetaData
-
initializeMapping
protected void initializeMapping()
Description copied from class:ClassMetaData
Initialize mapping. Logs init message by default.- Overrides:
initializeMapping
in classClassMetaData
-
clearDefinedFieldCache
protected void clearDefinedFieldCache()
Description copied from class:ClassMetaData
Clear defined field data.- Overrides:
clearDefinedFieldCache
in classClassMetaData
-
clearSubclassCache
protected void clearSubclassCache()
Description copied from class:ClassMetaData
Clear cached subclass data.- Overrides:
clearSubclassCache
in classClassMetaData
-
copy
public void copy(ClassMetaData cls)
Description copied from class:ClassMetaData
Copy the metadata from the given instance to this one. Do not copy mapping information.- Overrides:
copy
in classClassMetaData
-
validateDataStoreExtensionPrefix
protected boolean validateDataStoreExtensionPrefix(java.lang.String prefix)
Description copied from class:Extensions
Return true if extensions starting with the given official datastore prefix should be validated for this runtime.- Overrides:
validateDataStoreExtensionPrefix
in classExtensions
-
getAlias
public java.lang.String getAlias()
Description copied from interface:Strategy
Return the alias of this strategy. For custom strategies, return the full class name.
-
map
public void map(boolean adapt)
Description copied from interface:Strategy
Map the owning mapping using this strategy.
-
initialize
public void initialize()
Description copied from interface:Strategy
Perform caching and other initialization operations. This method is called afterStrategy.map(boolean)
, and after all related components have been mapped as well.- Specified by:
initialize
in interfaceStrategy
-
insert
public void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws java.sql.SQLException
Description copied from interface:Strategy
Set values for the mapping into the proper rows. For class mappings, this method will be called only after the corresponding method has been called for all fields of this mapping.
-
update
public void update(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws java.sql.SQLException
Description copied from interface:Strategy
Set values for the mapping into the proper rows.- Specified by:
update
in interfaceStrategy
- Throws:
java.sql.SQLException
- See Also:
Strategy.insert(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore, org.apache.openjpa.jdbc.sql.RowManager)
-
delete
public void delete(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws java.sql.SQLException
Description copied from interface:Strategy
Set the where values appropriately to delete the proper instance, and set all relations on non-secondary tables as updates. This allows foreign key analysis.- Specified by:
delete
in interfaceStrategy
- Throws:
java.sql.SQLException
- See Also:
Strategy.insert(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore, org.apache.openjpa.jdbc.sql.RowManager)
-
isCustomInsert
public java.lang.Boolean isCustomInsert(OpenJPAStateManager sm, JDBCStore store)
Description copied from interface:Strategy
ReturnBoolean.FALSE
if this mapping does not customize the insert process,Boolean.TRUE
if it does, or null if it does customize the insert, but also relies on the standard insert method being called. Implement theStrategy.customInsert(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore)
method to implement the custom insertion behavior.- Specified by:
isCustomInsert
in interfaceStrategy
-
isCustomUpdate
public java.lang.Boolean isCustomUpdate(OpenJPAStateManager sm, JDBCStore store)
Description copied from interface:Strategy
ReturnBoolean.FALSE
if this mapping does not customize the update process,Boolean.TRUE
if it does, or null if it does customize the update, but also relies on the standard update method being called. Implement theStrategy.customUpdate(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore)
method to override the default update behavior.- Specified by:
isCustomUpdate
in interfaceStrategy
-
isCustomDelete
public java.lang.Boolean isCustomDelete(OpenJPAStateManager sm, JDBCStore store)
Description copied from interface:Strategy
ReturnBoolean.FALSE
if this mapping does not customize the delete process,Boolean.TRUE
if it does, or null if it does customize the delete, but also relies on the standard delete method being called. Implement theStrategy.customDelete(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore)
method to override the default deletion behavior.- Specified by:
isCustomDelete
in interfaceStrategy
-
customInsert
public void customInsert(OpenJPAStateManager sm, JDBCStore store) throws java.sql.SQLException
Description copied from interface:Strategy
Override this method to customize flushing this mapping. For classes, this method must also flush all fields. For fields, this method is called after the owning object is inserted, so if this field is in a row with other fields, that row will already exist.- Specified by:
customInsert
in interfaceStrategy
- Throws:
java.sql.SQLException
-
customUpdate
public void customUpdate(OpenJPAStateManager sm, JDBCStore store) throws java.sql.SQLException
Description copied from interface:Strategy
Override this method to customize flushing this mapping. For classes, this method must also flush all fields.- Specified by:
customUpdate
in interfaceStrategy
- Throws:
java.sql.SQLException
-
customDelete
public void customDelete(OpenJPAStateManager sm, JDBCStore store) throws java.sql.SQLException
Description copied from interface:Strategy
Override this method to customize flushing this mapping. For classes, this method must also flush all fields. For fields, this method will be called after the owning object is deleted.- Specified by:
customDelete
in interfaceStrategy
- Throws:
java.sql.SQLException
-
setClassMapping
public void setClassMapping(ClassMapping owner)
Description copied from interface:ClassStrategy
Set the class mapping using this strategy. This will be called before use.- Specified by:
setClassMapping
in interfaceClassStrategy
-
isPrimaryKeyObjectId
public boolean isPrimaryKeyObjectId(boolean hasAll)
Description copied from interface:ClassStrategy
Return true if the this class' primary key columns correspond to the base class' primary key columns used to construct oid values. Base classes always return true. Classes that join to the base class table, though, may not always join using the same columns the base class uses for oid values, or may not use all the columns. When performing a select, we will join down to the most-derived class that is identified by oid values. We cannot use non-primary key field values for joining during selects, because the field values to join on might be the ones we're trying to select! Similarly, we can only reconstruct oid values for selected objects using classes whose primary keys store oid values.- Specified by:
isPrimaryKeyObjectId
in interfaceClassStrategy
- Parameters:
hasAll
- if true, there must be a primary key column for every base class primary key column; if false the primary key must only match a subset of the base class primary key columns
-
joinSuperclass
public Joins joinSuperclass(Joins joins, boolean toThis)
Description copied from interface:ClassStrategy
Join the mapping and its superclass.- Specified by:
joinSuperclass
in interfaceClassStrategy
toThis
- if false, inner join to the superclass table; if true, outer join from the superclass table to this table
-
supportsEagerSelect
public boolean supportsEagerSelect(Select sel, OpenJPAStateManager sm, JDBCStore store, ClassMapping base, JDBCFetchConfiguration fetch)
Description copied from interface:ClassStrategy
Return true if this strategy can perform the given select from the givenbase
mapping. The given state manager may be null if selecting multiple instances.- Specified by:
supportsEagerSelect
in interfaceClassStrategy
-
customLoad
public ResultObjectProvider customLoad(JDBCStore store, boolean subclasses, JDBCFetchConfiguration fetch, long startIdx, long endIdx) throws java.sql.SQLException
Description copied from interface:ClassStrategy
Implement this method to customize obtaining a result containing all instances of this class. Return null for standard loading.- Specified by:
customLoad
in interfaceClassStrategy
- Throws:
java.sql.SQLException
-
customLoad
public boolean customLoad(OpenJPAStateManager sm, JDBCStore store, PCState state, JDBCFetchConfiguration fetch) throws java.sql.SQLException, java.lang.ClassNotFoundException
Description copied from interface:ClassStrategy
Implement this method to load the state of a given object, without a previousResult
. Return true if this method handles the load. If the object does not exist in the data store, simply take no action on it (but still return true). Return false to use default loading.- Specified by:
customLoad
in interfaceClassStrategy
state
- if non-null, then you must initialize the state and persistent object of the given state manager (after determining the actual class of the object from the database, if there are possible persistent subclasses); initialization looks like this:sm.initialize (pcClass, state)
- Throws:
java.sql.SQLException
java.lang.ClassNotFoundException
-
customLoad
public boolean customLoad(OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Result result) throws java.sql.SQLException
Description copied from interface:ClassStrategy
Implement this method to customize loading from aResult
into an instance. Return true if this mapping handles the load; false if normal loading should proceed after calling this method.- Specified by:
customLoad
in interfaceClassStrategy
- Throws:
java.sql.SQLException
-
isVerticalStrategy
public boolean isVerticalStrategy()
-
-