- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
AbstractColumnMapping
,AbstractCompositeDirectCollectionMapping
,AbstractTransformationMapping
,AggregateMapping
,ForeignReferenceMapping
,XMLAbstractAnyMapping
,XMLAnyAttributeMapping
,XMLChoiceCollectionMapping
,XMLChoiceObjectMapping
Purpose: Defines how an attribute of an object maps to and from the database
Responsibilities:
- Define type of relationship (1:1/1:M/M:M/etc.)
- Define instance variable name and fields names required
- Define any additional properties (ownership, indirection, read only, etc.)
- Control building the value for the instance variable from the database row
- Control building the database fields from the object
- Control any pre/post updating/inserting/deleting required to maintain the relationship
- Merges object changes for unit of work.
- Clones objects for unit of work.
- cache computed information to optimize performance
- Since:
- TOPLink/Java 1.0
- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected AttributeAccessor
Wrapper to store the reference objects.protected String
PERF: Cache the mappings attribute name.protected DatabaseMapping
The id mapping this mapping derives.protected boolean
Used by the CMP3Policy to see if this mapping should be used in processing pk classes for find methodsprotected ClassDescriptor
ClassDescriptor to which this mapping belongs toprotected Vector
<DatabaseField> Fields associated with the mappings are cachedprotected boolean
protected Boolean
Irrelevant (and not set) unless descriptor has SerializedObjectPolicy (SOP).protected boolean
protected Boolean
Specifies whether this mapping is lazy, this means not included in the default fetch group.protected boolean
Records if this mapping is being used as a MapKeyMapping.protected boolean
Specifies whether this mapping is optional (i.e.protected boolean
PERF: Used as a quick check to see if this mapping is a primary key mapping, set by the object builder during initialization.protected boolean
Makes this mapping read only.protected boolean
It is needed only in remote initialization and mapping is in parent descriptorprotected String
A mapsId value.protected static final Vector
<DatabaseField> Used to reduce memory for mappings with no fields.protected static final Integer
Used to share integer instance to reduce memory.protected Map
Allow user defined properties.Allow the user to defined un-converted properties which will be initialized at runtime.protected Integer
This is a TopLink defined attribute that allows us to sort the mappingsprotected static final Integer
protected static final Integer
protected static final Integer
protected static final Integer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addUnconvertedProperty
(String propertyName, String propertyValue, String propertyType) PUBLIC: Add an unconverted property (to be initialiazed at runtime)abstract void
buildBackupClone
(Object clone, Object backup, UnitOfWorkImpl unitOfWork) INTERNAL: Clone the attribute from the clone and assign it to the backup.buildBackupCloneForPartObject
(Object attributeValue, Object clone, Object backup, UnitOfWorkImpl unitOfWork) INTERNAL: Require for cloning, the part must be cloned.buildChangeRecord
(Object newValue, ObjectChangeSet owner, AbstractSession session) INTERNAL: Directly build a change record without comparisonabstract void
buildClone
(Object original, CacheKey cacheKey, Object clone, Integer refreshCascade, AbstractSession cloningSession) INTERNAL: Clone the attribute from the original and assign it to the clone.buildCloneForPartObject
(Object attributeValue, Object original, CacheKey cacheKey, Object clone, AbstractSession cloningSession, Integer refreshCascade, boolean isExisting, boolean isFromSharedCache) INTERNAL: Require for cloning, the part must be cloned.abstract void
buildCloneFromRow
(AbstractRecord databaseRow, JoinedAttributeManager joinManager, Object clone, CacheKey sharedCacheKey, ObjectBuildingQuery sourceQuery, UnitOfWorkImpl unitOfWork, AbstractSession executionSession) INTERNAL: A combination of readFromRowIntoObject and buildClone.buildContainerClone
(Object attributeValue, AbstractSession cloningSession) INTERNAL: Performs a first level clone of the attribute.void
INTERNAL: Copy of the attribute of the object.buildExpression
(Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, Map processedObjects, AbstractSession session) INTERNAL: In case Query By Example is used, this method builds and returns an expression that corresponds to a single attribue and it's value.buildObjectJoinExpression
(Expression base, Object value, AbstractSession session) INTERNAL: Used to allow object level comparisons.buildObjectJoinExpression
(Expression base, Expression argument, AbstractSession session) INTERNAL: Used to allow object level comparisons.void
buildShallowOriginalFromRow
(AbstractRecord databaseRow, Object original, JoinedAttributeManager joinManager, ObjectBuildingQuery query, AbstractSession executionSession) INTERNAL: Builds a shallow original object.void
calculateDeferredChanges
(ChangeRecord changeRecord, AbstractSession session) INTERNAL: Used by AttributeLevelChangeTracking to update a changeRecord with calculated changes as apposed to detected changes.void
cascadeDiscoverAndPersistUnregisteredNewObjects
(Object object, Map newObjects, Map unregisteredExistingObjects, Map visitedObjects, UnitOfWorkImpl uow, Set cascadeErrors) INTERNAL: Cascade discover and persist new objects during commit.abstract void
cascadePerformRemoveIfRequired
(Object object, UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade registerNew for Create through mappings that require the cascadevoid
cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired
(Object object, UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade removal of orphaned private owned objects from the UnitOfWorkChangeSetabstract void
cascadeRegisterNewIfRequired
(Object object, UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade registerNew for Create through mappings that require the cascadeclone()
INTERNAL: Clones itself.protected Vector
cloneFields
(Vector fields) INTERNAL: Helper method to clone vector of fields (used in aggregate initialization cloning).protected Vector
<DatabaseField> This method must be overwritten in the subclasses to return a vector of all the fields this mapping represents.void
collectQueryParameters
(Set<DatabaseField> record) INTERNAL: This method is used to store the FK fields that can be cached that correspond to noncacheable mappings the FK field values will be used to re-issue the query when cloning the shared cache entityabstract ChangeRecord
compareForChange
(Object clone, Object backup, ObjectChangeSet owner, AbstractSession session) INTERNAL: This method was created in VisualAge.abstract boolean
compareObjects
(Object firstObject, Object secondObject, AbstractSession session) INTERNAL: Compare the attributes belonging to this mapping for the objects.void
convertClassNamesToClasses
(ClassLoader classLoader) INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings This method is implemented by subclasses as necessary.protected void
convertConverterClassNamesToClasses
(Converter converter, ClassLoader classLoader) Convenience method to ensure converters have an opportunity to convert any class names to classes during project setup.<T> DatabaseValueHolder
<T> createCloneValueHolder
(ValueHolderInterface<T> attributeValue, Object original, Object clone, AbstractRecord row, AbstractSession cloningSession, boolean buildDirectlyFromRow) INTERNAL: Builder the unit of work value holder.boolean
ADVANCED: Returns true if the mapping references a JPA ID attribute for the CMP3Policy and JPA ID classes.void
earlyPreDelete
(DeleteObjectQuery query, Object object) INTERNAL: This method is called to update collection tables prior to commit.protected List
<Expression> extractNestedExpressions
(List<Expression> expressions, ExpressionBuilder newRoot) INTERNAL: Extract the nested attribute expressions that apply to this mapping.protected List
<Expression> extractNestedNonAggregateExpressions
(List<Expression> expressions, ExpressionBuilder newRoot, boolean rootExpressionsAllowed) INTERNAL: Extract the nested attribute expressions that apply to this mapping.abstract void
fixObjectReferences
(Object object, Map<Object, ObjectDescriptor> objectDescriptors, Map<Object, Object> processedObjects, ObjectLevelReadQuery query, DistributedSession session) INTERNAL: An object has been serialized from the server to the client.void
fixRealObjectReferences
(Object object, Map<Object, ObjectDescriptor> objectInformation, Map<Object, Object> processedObjects, ObjectLevelReadQuery query, DistributedSession session) INTERNAL: At this point, we realize we don't have indirection; so we need to replace the reference object(s) with the corresponding object(s) from the remote session.ADVANCED: Return the attributeAccessor.Class
<?> PUBLIC: The classification type for the attribute this mapping representsPUBLIC: Return the name of the attribute set in the mapping.getAttributeValueFromObject
(Object object) INTERNAL: Return the value of an attribute which this mapping represents for an object.INTERNAL: Return the mapping's containerPolicy.ADVANCED: Set the maps id valueINTERNAL: Return the descriptor to which this mapping belongsgetField()
INTERNAL: Return the field associated with this mapping if there is exactly one.Class
<?> getFieldClassification
(DatabaseField fieldToClassify) INTERNAL: Return the classification for the field contained in the mapping.INTERNAL: Returns a vector of all the fields this mapping represents.PUBLIC: This method is invoked reflectively on the reference object to return the value of the attribute in the object.ADVANCED: Set the mapped by id valuegetObjectCorrespondingTo
(Object object, DistributedSession session, Map<Object, ObjectDescriptor> objectDescriptors, Map<Object, Object> processedObjects, ObjectLevelReadQuery query) INTERNAL: return the object on the client corresponding to the specified object.INTERNAL: Return the list of fields that should be used if this mapping is used in an order by.INTERNAL: used as a temporary store for custom SDK usagegetProperty
(Object property) ADVANCED: Allow user defined properties.getRealAttributeValueFromAttribute
(Object attributeValue, Object object, AbstractSession session) INTERNAL: Return the value of an attribute unwrapping value holders if required.getRealAttributeValueFromObject
(Object object, AbstractSession session) INTERNAL: Return the value of an attribute unwrapping value holders if required.getRealCollectionAttributeValueFromObject
(Object object, AbstractSession session) INTERNAL: Return the value of an attribute, unwrapping value holders if necessary.PUBLIC: Return the referenceDescriptor.INTERNAL: Return the relationshipPartner mapping for this bi-directional mapping.INTERNAL: Returns the set of fields that should be selected to build this mapping's value(s).INTERNAL: Returns the table(s) that should be selected to build this mapping's value(s).PUBLIC: This method is invoked reflectively on the reference object to set the value of the attribute in the object.INTERNAL: Used to store un-converted properties, which are subsequenctly converted at runtime (through the convertClassNamesToClasses method.getValueFromRemoteValueHolder
(RemoteValueHolder remoteValueHolder) INTERNAL: extract and return the appropriate value from the specified remote value holderINTERNAL: Return the weight of the mapping, used to sort mappings to ensure that DirectToField Mappings get merged firstboolean
INTERNAL: The returns if the mapping has any constraint dependencies, such as foreign keys and join tables.boolean
INTERNAL: Return if the mapping has any ownership or other dependency over its target object(s).boolean
INTERNAL: The returns if the mapping has any inverse constraint dependencies, such as foreign keys and join tables.boolean
ADVANCED: Set the mapped by id valueboolean
INTERNAL: Indicates whether the mapping (or at least one of its nested mappings, at any nested depth) references an entity.protected boolean
hasRootExpressionThatShouldUseOuterJoin
(List expressions) INTERNAL: If there is root expression in the list then indicates whether it shouldUseOuterJoin, otherwise return false.boolean
INTERNAL: Used to store un-converted properties, which are subsequenctly converted at runtime (through the convertClassNamesToClasses method.void
initialize
(AbstractSession session) INTERNAL: Allow for initialization of properties and validation.void
instantiateAttribute
(Object object, AbstractSession session) INTERNAL: Trigger the instantiation of the attribute if lazy.boolean
INTERNAL:boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Return whether the specified object is instantiated.boolean
Used to signal that this mapping references a protected/isolated entity and requires special merge/object building behaviour.boolean
INTERNAL: Returns true if the mapping should be added to the UnitOfWork's list of private owned objects for private owned orphan removal.boolean
INTERNAL: Used when determining if a mapping supports cascaded version optimistic locking.boolean
isChangeTrackingSupported
(Project project) INTERNAL: Return if this mapping supports change tracking.boolean
INTERNAL: Return if this mapping requires its attribute value to be cloned.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL:boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: All EIS mappings should implement this method to return true.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Indicates whether the mapping is both in and out of SerializedObjectPolicy's sopObject.boolean
INTERNAL: Indicates whether the mapping is in SerializedObjectPolicy's sopObject and not out of it.boolean
INTERNAL: Indicates whether the mapping is in SerializedObjectPolicy's sopObject.boolean
INTERNAL: Return if this mapping support joining.boolean
isJPAId()
INTERNAL: Flags that this mapping is part of a JPA id mapping.boolean
isLazy()
Return if this mapping is lazy.boolean
INTERNAL: Return whether this mapping should be traversed when we are lockingboolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
boolean
INTERNALboolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
Return whether the value of this mapping is optional (that is, can be null).boolean
INTERNAL: Indicates whether the mapping is out of SerializedObjectPolicy's sopObject and not in it.boolean
INTERNAL: Indicates whether the mapping is out of SerializedObjectPolicy's sopObject.boolean
isOwned()
Returns true if this mapping is owned by the parent descriptor.boolean
INTERNAL: Set by the Object builder during initialization returns true if this mapping is used as a primary key mapping.boolean
INTERNAL: Return if the mapping has ownership over its target object(s).boolean
INTERNAL: Returns true if mapping is read only else false.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: All relational mappings should implement this method to return true.protected boolean
boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL:boolean
PUBLIC: Return if method access is used.boolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL: Some mappings support no attribute (transformation and multitenant primary key).boolean
INTERNAL: All relational mappings should implement this method to return true.abstract void
iterate
(DescriptorIterator iterator) INTERNAL: Iterate on the appropriate attribute value.void
iterateOnRealAttributeValue
(DescriptorIterator iterator, Object realAttributeValue) INTERNAL: Iterate on the attribute value.void
load
(Object object, AttributeItem item, AbstractSession session, boolean fromFetchGroup) Force instantiation of the load group.void
loadAll
(Object object, AbstractSession session, IdentityHashSet loaded) Force instantiation of all indirections.abstract void
mergeChangesIntoObject
(Object target, ChangeRecord changeRecord, Object source, MergeManager mergeManager, AbstractSession targetSession) INTERNAL: Merge changes from the source to the target object.abstract void
mergeIntoObject
(Object target, boolean isTargetUninitialized, Object source, MergeManager mergeManager, AbstractSession targetSession) INTERNAL: Merge changes from the source to the target object.void
performDataModificationEvent
(Object[] event, AbstractSession session) INTERNAL: Perform the commit event.void
postCalculateChanges
(ChangeRecord changeRecord, UnitOfWorkImpl uow) INTERNAL: Overridden by mappings that require additional processing of the change record after the record has been calculated.void
postCalculateChangesOnDeleted
(Object deletedObject, UnitOfWorkChangeSet uowChangeSet, UnitOfWorkImpl uow) INTERNAL: Overridden by mappings that require objects to be deleted contribute to change set creation.void
postDelete
(DeleteObjectQuery query) INTERNAL: A subclass should implement this method if it wants different behavior.void
postInitialize
(AbstractSession session) INTERNAL: Allow for initialization of properties and validation that have dependecies no the descriptor being initialized.void
INTERNAL: Mapping callback for post-initialization of source and target expression fields created when a mapping's selectionCriteria is created early with uninitialized fields.void
postInsert
(WriteObjectQuery query) INTERNAL: A subclass should implement this method if it wants different behavior.void
postUpdate
(WriteObjectQuery query) INTERNAL: A subclass should implement this method if it wants different behavior.void
preDelete
(DeleteObjectQuery query) INTERNAL: A subclass should implement this method if it wants different behavior.void
preInitialize
(AbstractSession session) INTERNAL: Allow for initialization of properties and validation.void
preInsert
(WriteObjectQuery query) INTERNAL: A subclass should implement this method if it wants different behavior.void
INTERNAL: A subclass that supports cascade version optimistic locking should implement this method to properly prepare the locking policy for their mapping type.void
preUpdate
(WriteObjectQuery query) INTERNAL: A subclass should implement this method if it wants different behavior.readFromResultSetIntoObject
(ResultSet resultSet, Object targetObject, ObjectBuildingQuery query, AbstractSession session, DatabaseAccessor accessor, ResultSetMetaData metaData, int columnNumber, DatabasePlatform platform) INTERNAL: Extract values directly from the result-set.readFromRowIntoObject
(AbstractRecord databaseRow, JoinedAttributeManager joinManager, Object targetObject, CacheKey parentCacheKey, ObjectBuildingQuery sourceQuery, AbstractSession executionSession, boolean isTargetProtected) INTERNAL: Extract value from the row and set the attribute to this value in the object.void
readOnly()
PUBLIC: To make mapping read only.void
PUBLIC: The mapping can be dynamically made either readOnly or readWriteOnly.void
recordPrivateOwnedRemovals
(Object object, UnitOfWorkImpl uow) INTERNAL: Overridden by mappings that require objects to be deleted contribute to change set creation.void
rehashFieldDependancies
(AbstractSession session) INTERNAL: Rehash any hashtables based on fields.void
remoteInitialization
(DistributedSession session) INTERNAL: Once descriptors are serialized to the remote session.protected void
Set the mapping to be initialized for the remote session.replaceValueHoldersIn
(Object object, RemoteSessionController controller) INTERNAL: replace the value holders in the specified reference object(s)void
setAttributeAccessor
(AttributeAccessor attributeAccessor) ADVANCED: Set the attributeAccessor.void
setAttributeName
(String attributeName) PUBLIC: Sets the name of the attribute in the mapping.void
setAttributeValueInObject
(Object object, Object value) INTERNAL: Set the value of the attribute mapped by this mapping.void
setChangeListener
(Object clone, PropertyChangeListener listener, UnitOfWorkImpl uow) INTERNAL: Set the change listener if required.void
setDerivedIdMapping
(DatabaseMapping derivedIdMapping) ADVANCED: Used to indicate the mapping references a JPA ID or MapsId attribute for the CMP3Policy and JPA Id classes (as well as Embeddable Id classes).void
setDerivesId
(boolean derivesId) ADVANCED: Used to indicate the mapping references a JPA ID or MapsId attribute for the CMP3Policy and JPA Id classes (as well as Embeddable Id classes).void
setDescriptor
(ClassDescriptor descriptor) INTERNAL: Set the descriptor to which this mapping belongsprotected void
setFields
(Vector<DatabaseField> fields) INTERNAL: Set the mapping's field collection.void
setGetMethodName
(String methodName) PUBLIC: This method is invoked reflectively on the reference object to return the value of the attribute in the object.void
setIsCacheable
(boolean cacheable) Used to signal that this mapping references a protected/isolated entity and requires special merge/object building behaviour.void
INTERNAL: Set the mapping is both in and out of SerializedObjectPolicy's sopObjectvoid
INTERNAL: Set the mapping is in SerializedObjectPolicy's sopObject.void
INTERNAL: Flags that this mapping is part of a JPA id mapping.void
setIsLazy
(boolean isLazy) Set if this mapping is lazy.void
setIsMapKeyMapping
(boolean isMapKeyMapping) void
setIsOptional
(boolean isOptional) Used to specify whether the value of this mapping may be null.void
INTERNAL: Set the mapping is out of SerializedObjectPolicy's sopObject.void
setIsPrimaryKeyMapping
(boolean isPrimaryKeyMapping) INTERNAL: Set by the Object builder during initialization returns true if this mapping is used as a primary key mapping.void
setIsReadOnly
(boolean aBoolean) PUBLIC: Set this mapping to be read only.void
setMapsIdValue
(String mapsIdValue) ADVANCED: Set the maps id valuevoid
setProperties
(Map properties) INTERNAL: Allow user defined properties.void
setProperty
(Object property, Object value) ADVANCED: Allow user defined properties.void
setRealAttributeValueInObject
(Object object, Object value) INTERNAL: Set the value of the attribute mapped by this mapping, placing it inside a value holder if necessary.void
setSetMethodName
(String methodName) PUBLIC: Set the methodName used to set the value for the mapping's attribute into the object.void
ADVANCED: Set the weight of the mapping, used to sort mappings DirectToField Mappings have a default weight of 1 while all other Mappings have a default weight of MAXINT.void
simpleAddToCollectionChangeRecord
(Object referenceKey, Object changeSetToAdd, ObjectChangeSet changeSet, AbstractSession session) ADVANCED: This method is used to add an object to a collection once the changeSet is applied.void
simpleRemoveFromCollectionChangeRecord
(Object referenceKey, Object changeSetToAdd, ObjectChangeSet changeSet, AbstractSession session) ADVANCED: This method is used to remove an object from a collection once the changeSet is applied.toString()
INTERNAL: Print the mapping attribute name, this is used in error messages.void
updateChangeRecord
(Object clone, Object newValue, Object oldValue, ObjectChangeSet objectChangeSet, UnitOfWorkImpl uow) INTERNAL: Either create a new change record or update the change record with the new value.void
updateCollectionChangeRecord
(CollectionChangeEvent event, ObjectChangeSet objectChangeSet, UnitOfWorkImpl uow) INTERNAL: Add or removes a new value and its change set to the collection change record based on the event passed in.void
INTERNAL: Allow for subclasses to perform validation.void
INTERNAL: Allow for subclasses to perform validation.valueFromObject
(Object anObject, DatabaseField field, AbstractSession session) INTERNAL: A subclass should extract the value from the object for the field, if it does not map the field then it should return null.valueFromResultSet
(ResultSet resultSet, ObjectBuildingQuery query, AbstractSession session, DatabaseAccessor accessor, ResultSetMetaData metaData, int columnNumber, DatabasePlatform platform) INTERNAL: Returns the value for the mapping directly from the result-set.valueFromRow
(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, boolean isTargetProtected) INTERNAL: A subclass should implement this method if it wants different behavior.valueFromRow
(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, CacheKey cacheKey, AbstractSession session, boolean isTargetProtected, Boolean[] wasCacheUsed) INTERNAL: A subclass should implement this method if it wants different behavior.boolean
verifyDelete
(Object object, AbstractSession session) INTERNAL: To verify if the specified object has been deleted or not.void
writeFromAttributeIntoRow
(Object attribute, AbstractRecord row, AbstractSession session) INTERNAL: A subclass should implement this method if it wants different behavior.void
writeFromObjectIntoRow
(Object object, AbstractRecord row, AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL: A subclass should implement this method if it wants different behavior.void
writeFromObjectIntoRowForShallowInsert
(Object object, AbstractRecord row, AbstractSession session) INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts.void
writeFromObjectIntoRowForShallowInsertWithChangeRecord
(ChangeRecord changeRecord, AbstractRecord row, AbstractSession session) INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts.void
INTERNAL:void
writeFromObjectIntoRowForUpdateAfterShallowInsert
(Object object, AbstractRecord databaseRow, AbstractSession session, DatabaseTable table) INTERNAL: This row is built for update after shallow insert which happens in case of bidirectional inserts.void
writeFromObjectIntoRowForUpdateBeforeShallowDelete
(Object object, AbstractRecord databaseRow, AbstractSession session, DatabaseTable table) INTERNAL: This row is built for update before shallow delete which happens in case of bidirectional inserts.void
INTERNAL: A subclass should implement this method if it wants different behavior.void
writeFromObjectIntoRowWithChangeRecord
(ChangeRecord changeRecord, AbstractRecord row, AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL: A subclass should implement this method if it wants different behavior.void
writeInsertFieldsIntoRow
(AbstractRecord databaseRow, AbstractSession session) INTERNAL: Write fields needed for insert into the template for with null values.void
writeUpdateFieldsIntoRow
(AbstractRecord databaseRow, AbstractSession session) INTERNAL: Write fields needed for update into the template for with null values.
-
Field Details
-
NO_FIELDS
Used to reduce memory for mappings with no fields. -
NO_WEIGHT
Used to share integer instance to reduce memory. -
WEIGHT_DIRECT
-
WEIGHT_TRANSFORM
-
WEIGHT_AGGREGATE
-
WEIGHT_TO_ONE
-
descriptor
ClassDescriptor to which this mapping belongs to -
attributeAccessor
Wrapper to store the reference objects. -
isReadOnly
protected boolean isReadOnlyMakes this mapping read only. No write are performed on it. Default is false -
isOptional
protected boolean isOptionalSpecifies whether this mapping is optional (i.e. field may be null). Used for DDL generation. -
isLazy
Specifies whether this mapping is lazy, this means not included in the default fetch group. -
fields
Fields associated with the mappings are cached -
isRemotelyInitialized
protected boolean isRemotelyInitializedIt is needed only in remote initialization and mapping is in parent descriptor -
weight
This is a TopLink defined attribute that allows us to sort the mappings -
properties
Allow user defined properties. -
unconvertedProperties
Allow the user to defined un-converted properties which will be initialized at runtime. -
derivesId
protected boolean derivesIdUsed by the CMP3Policy to see if this mapping should be used in processing pk classes for find methods -
isJPAId
protected boolean isJPAId -
mapsIdValue
A mapsId value. -
derivedIdMapping
The id mapping this mapping derives. Used by the CMP3Policy to see if this mapping should be used in processing pk classes for find methods. -
isPrimaryKeyMapping
protected boolean isPrimaryKeyMappingPERF: Used as a quick check to see if this mapping is a primary key mapping, set by the object builder during initialization. -
attributeName
PERF: Cache the mappings attribute name. -
isMapKeyMapping
protected boolean isMapKeyMappingRecords if this mapping is being used as a MapKeyMapping. This is important for recording main mappings -
isCacheable
protected boolean isCacheable -
isInSopObject
Irrelevant (and not set) unless descriptor has SerializedObjectPolicy (SOP). If descriptor has SOP, then ObjectLevelReadQuery (with shouldUseSerializedObjectPolicy flag set to true) reads in row that contain both field/value pairs and sopObject. This flag indicates whether the data for this mapping is contained in the row's sopObject or in fields/values. Boolean.TRUE - sopObject (in sopObject) Boolean.FALSE - fields/values (out sopObject); null - both sopObject and fields/values (both in and out sopObject). While writing to the data base the mapping will be used for writing into sopObject unless this flag is set to Boolean.FALSE;
-
-
Constructor Details
-
DatabaseMapping
protected DatabaseMapping()PUBLIC: Default constructor.
-
-
Method Details
-
addUnconvertedProperty
PUBLIC: Add an unconverted property (to be initialiazed at runtime)- Parameters:
propertyName
- TODOpropertyValue
- TODOpropertyType
- TODO
-
buildBackupClone
INTERNAL: Clone the attribute from the clone and assign it to the backup.- Parameters:
clone
- TODObackup
- TODOunitOfWork
- TODO
-
buildBackupCloneForPartObject
public Object buildBackupCloneForPartObject(Object attributeValue, Object clone, Object backup, UnitOfWorkImpl unitOfWork) INTERNAL: Require for cloning, the part must be cloned.- Parameters:
attributeValue
- TODOclone
- TODObackup
- TODOunitOfWork
- TODO- Returns:
- TODO
-
buildClone
public abstract void buildClone(Object original, CacheKey cacheKey, Object clone, Integer refreshCascade, AbstractSession cloningSession) INTERNAL: Clone the attribute from the original and assign it to the clone.- Parameters:
original
- TODOcacheKey
- TODOclone
- TODOrefreshCascade
- TODOcloningSession
- TODO
-
buildCloneFromRow
public abstract void buildCloneFromRow(AbstractRecord databaseRow, JoinedAttributeManager joinManager, Object clone, CacheKey sharedCacheKey, ObjectBuildingQuery sourceQuery, UnitOfWorkImpl unitOfWork, AbstractSession executionSession) INTERNAL: A combination of readFromRowIntoObject and buildClone.buildClone assumes the attribute value exists on the original and can simply be copied.
readFromRowIntoObject assumes that one is building an original.
Both of the above assumptions are false in this method, and actually attempts to do both at the same time.
Extract value from the row and set the attribute to this value in the working copy clone. In order to bypass the shared cache when in transaction a UnitOfWork must be able to populate working copies directly from the row.
- Parameters:
databaseRow
- TODOjoinManager
- TODOclone
- TODOsharedCacheKey
- TODOsourceQuery
- TODOunitOfWork
- TODOexecutionSession
- TODO
-
buildShallowOriginalFromRow
public void buildShallowOriginalFromRow(AbstractRecord databaseRow, Object original, JoinedAttributeManager joinManager, ObjectBuildingQuery query, AbstractSession executionSession) INTERNAL: Builds a shallow original object. Only direct attributes and primary keys are populated. In this way the minimum original required for instantiating a working copy clone can be built without placing it in the shared cache (no concern over cycles).- Parameters:
databaseRow
- TODOoriginal
- TODOjoinManager
- TODOquery
- TODOexecutionSession
- TODO
-
buildCloneForPartObject
public Object buildCloneForPartObject(Object attributeValue, Object original, CacheKey cacheKey, Object clone, AbstractSession cloningSession, Integer refreshCascade, boolean isExisting, boolean isFromSharedCache) INTERNAL: Require for cloning, the part must be cloned.- Parameters:
attributeValue
- TODOoriginal
- TODOcacheKey
- TODOclone
- TODOcloningSession
- TODOrefreshCascade
- TODOisExisting
- TODOisFromSharedCache
- TODO- Returns:
- TODO
-
buildContainerClone
INTERNAL: Performs a first level clone of the attribute. This generally means on the container will be cloned.- Parameters:
attributeValue
- TODOcloningSession
- TODO- Returns:
- TODO
-
buildCopy
INTERNAL: Copy of the attribute of the object. This is NOT used for unit of work but for templatizing an object.- Parameters:
copy
- TODOoriginal
- TODOgroup
- TODO
-
buildExpression
public Expression buildExpression(Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, Map processedObjects, AbstractSession session) INTERNAL: In case Query By Example is used, this method builds and returns an expression that corresponds to a single attribue and it's value.- Parameters:
queryObject
- TODOpolicy
- TODOexpressionBuilder
- TODOprocessedObjects
- TODOsession
- TODO- Returns:
- TODO
-
buildObjectJoinExpression
INTERNAL: Used to allow object level comparisons.- Parameters:
base
- TODOvalue
- TODOsession
- TODO- Returns:
- TODO
-
buildObjectJoinExpression
public Expression buildObjectJoinExpression(Expression base, Expression argument, AbstractSession session) INTERNAL: Used to allow object level comparisons.- Parameters:
base
- TODOargument
- TODOsession
- TODO- Returns:
- TODO
-
cascadePerformRemoveIfRequired
public abstract void cascadePerformRemoveIfRequired(Object object, UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade registerNew for Create through mappings that require the cascade- Parameters:
object
- TODOuow
- TODOvisitedObjects
- TODO
-
cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired
public void cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired(Object object, UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade removal of orphaned private owned objects from the UnitOfWorkChangeSet- Parameters:
object
- TODOuow
- TODOvisitedObjects
- TODO
-
cascadeRegisterNewIfRequired
public abstract void cascadeRegisterNewIfRequired(Object object, UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade registerNew for Create through mappings that require the cascade- Parameters:
object
- TODOuow
- TODOvisitedObjects
- TODO
-
cascadeDiscoverAndPersistUnregisteredNewObjects
public void cascadeDiscoverAndPersistUnregisteredNewObjects(Object object, Map newObjects, Map unregisteredExistingObjects, Map visitedObjects, UnitOfWorkImpl uow, Set cascadeErrors) INTERNAL: Cascade discover and persist new objects during commit.- Parameters:
object
- TODOnewObjects
- TODOunregisteredExistingObjects
- TODOvisitedObjects
- TODOuow
- TODOcascadeErrors
- TODO
-
calculateDeferredChanges
INTERNAL: Used by AttributeLevelChangeTracking to update a changeRecord with calculated changes as apposed to detected changes. If an attribute can not be change tracked it's changes can be detected through this process.- Parameters:
changeRecord
- TODOsession
- TODO
-
clone
INTERNAL: Clones itself. -
cloneFields
INTERNAL: Helper method to clone vector of fields (used in aggregate initialization cloning).- Parameters:
fields
- TODO- Returns:
- TODO
-
collectFields
This method must be overwritten in the subclasses to return a vector of all the fields this mapping represents.- Returns:
- TODO
-
collectQueryParameters
INTERNAL: This method is used to store the FK fields that can be cached that correspond to noncacheable mappings the FK field values will be used to re-issue the query when cloning the shared cache entity- Parameters:
record
- TODO
-
postInitializeSourceAndTargetExpressions
public void postInitializeSourceAndTargetExpressions()INTERNAL: Mapping callback for post-initialization of source and target expression fields created when a mapping's selectionCriteria is created early with uninitialized fields.- See Also:
-
compareForChange
public abstract ChangeRecord compareForChange(Object clone, Object backup, ObjectChangeSet owner, AbstractSession session) INTERNAL: This method was created in VisualAge.- Parameters:
clone
- TODObackup
- TODOowner
- TODOsession
- TODO- Returns:
- prototype.changeset.ChangeRecord TODO
-
compareObjects
public abstract boolean compareObjects(Object firstObject, Object secondObject, AbstractSession session) INTERNAL: Compare the attributes belonging to this mapping for the objects.- Parameters:
firstObject
- TODOsecondObject
- TODOsession
- TODO- Returns:
- TODO
-
convertClassNamesToClasses
INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings This method is implemented by subclasses as necessary.- Parameters:
classLoader
- TODO
-
convertConverterClassNamesToClasses
Convenience method to ensure converters have an opportunity to convert any class names to classes during project setup.- Parameters:
converter
- TODOclassLoader
- TODO
-
createCloneValueHolder
public <T> DatabaseValueHolder<T> createCloneValueHolder(ValueHolderInterface<T> attributeValue, Object original, Object clone, AbstractRecord row, AbstractSession cloningSession, boolean buildDirectlyFromRow) INTERNAL: Builder the unit of work value holder.- Parameters:
attributeValue
- TODOoriginal
- TODOclone
- TODOrow
- TODOcloningSession
- TODObuildDirectlyFromRow
- indicates that we are building the clone directly from a row as opposed to building the original from the row, putting it in the shared cache, and then cloning the original.- Returns:
- TODO
-
derivesId
public boolean derivesId()ADVANCED: Returns true if the mapping references a JPA ID attribute for the CMP3Policy and JPA ID classes.- Returns:
- TODO
-
earlyPreDelete
INTERNAL: This method is called to update collection tables prior to commit.- Parameters:
query
- TODOobject
- TODO
-
extractNestedExpressions
protected List<Expression> extractNestedExpressions(List<Expression> expressions, ExpressionBuilder newRoot) INTERNAL: Extract the nested attribute expressions that apply to this mapping. This is used for partial objects, and batch fetching.- Parameters:
expressions
- TODOnewRoot
- TODO- Returns:
- TODO
-
extractNestedNonAggregateExpressions
protected List<Expression> extractNestedNonAggregateExpressions(List<Expression> expressions, ExpressionBuilder newRoot, boolean rootExpressionsAllowed) INTERNAL: Extract the nested attribute expressions that apply to this mapping. This is used for joining, and locking. For aggregates return the nested foreign reference mapping, not the aggregate, as the aggregates are not joined, and share their parent's query.- Parameters:
expressions
- TODOnewRoot
- TODOrootExpressionsAllowed
- true if newRoot itself can be one of the expressions returned (used for locking)- Returns:
- TODO
-
hasRootExpressionThatShouldUseOuterJoin
INTERNAL: If there is root expression in the list then indicates whether it shouldUseOuterJoin, otherwise return false.- Parameters:
expressions
- TODO- Returns:
- TODO
-
hasUnconvertedProperties
public boolean hasUnconvertedProperties()INTERNAL: Used to store un-converted properties, which are subsequenctly converted at runtime (through the convertClassNamesToClasses method.- Returns:
- TODO
-
fixObjectReferences
public abstract void fixObjectReferences(Object object, Map<Object, ObjectDescriptor> objectDescriptors, Map<Object, Object> processedObjects, ObjectLevelReadQuery query, DistributedSession session) INTERNAL: An object has been serialized from the server to the client. Replace the transient attributes of the remote value holders with client-side objects.- Parameters:
object
- TODOobjectDescriptors
- TODOprocessedObjects
- TODOquery
- TODOsession
- TODO
-
fixRealObjectReferences
public void fixRealObjectReferences(Object object, Map<Object, ObjectDescriptor> objectInformation, Map<Object, Object> processedObjects, ObjectLevelReadQuery query, DistributedSession session) INTERNAL: At this point, we realize we don't have indirection; so we need to replace the reference object(s) with the corresponding object(s) from the remote session. The default is to do nothing.- Parameters:
object
- TODOobjectInformation
- TODOprocessedObjects
- TODOquery
- TODOsession
- TODO
-
getAttributeAccessor
ADVANCED: Return the attributeAccessor. The attribute accessor is responsible for setting and retrieving the attribute value from the object for this mapping.- Specified by:
getAttributeAccessor
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
getAttributeClassification
PUBLIC: The classification type for the attribute this mapping represents- Specified by:
getAttributeClassification
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
getAttributeName
PUBLIC: Return the name of the attribute set in the mapping.- Specified by:
getAttributeName
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
getAttributeValueFromObject
INTERNAL: Return the value of an attribute which this mapping represents for an object.- Specified by:
getAttributeValueFromObject
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Parameters:
object
- TODO- Returns:
- TODO
- Throws:
DescriptorException
-
getContainerPolicy
INTERNAL: Return the mapping's containerPolicy.- Specified by:
getContainerPolicy
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
getDerivedIdMapping
ADVANCED: Set the maps id value- Returns:
- TODO
-
getDescriptor
INTERNAL: Return the descriptor to which this mapping belongs- Specified by:
getDescriptor
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
getField
INTERNAL: Return the field associated with this mapping if there is exactly one. This is required for object relational mapping to print them, but because they are defined in in an Enterprise context they cannot be cast to. Mappings that have a field include direct mappings and object relational mappings.- Specified by:
getField
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
getFieldClassification
INTERNAL: Return the classification for the field contained in the mapping. This is used to convert the row value to a consistent java value. By default this is unknown. -
getSelectFields
INTERNAL: Returns the set of fields that should be selected to build this mapping's value(s). This is used by expressions to determine which fields to include in the select clause for non-object expressions.- Returns:
- TODO
-
getSelectTables
INTERNAL: Returns the table(s) that should be selected to build this mapping's value(s). This is used by expressions to determine which tables to include in the from clause for non-object expressions.- Returns:
- TODO
-
getFields
INTERNAL: Returns a vector of all the fields this mapping represents.- Specified by:
getFields
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
getOrderByNormalizedExpressions
INTERNAL: Return the list of fields that should be used if this mapping is used in an order by. null means this mapping does not need to normalize it fields (it is a field). -
getGetMethodName
PUBLIC: This method is invoked reflectively on the reference object to return the value of the attribute in the object. This method returns the name of the getMethodName or null if not using method access.- Returns:
- TODO
-
hasMapsIdValue
public boolean hasMapsIdValue()ADVANCED: Set the mapped by id value- Returns:
- TODO
-
getMapsIdValue
ADVANCED: Set the mapped by id value- Returns:
- TODO
-
getObjectCorrespondingTo
public Object getObjectCorrespondingTo(Object object, DistributedSession session, Map<Object, ObjectDescriptor> objectDescriptors, Map<Object, Object> processedObjects, ObjectLevelReadQuery query) INTERNAL: return the object on the client corresponding to the specified object. The default is to simply return the object itself, without worrying about maintaining object identity.- Parameters:
object
- TODOsession
- TODOobjectDescriptors
- TODOprocessedObjects
- TODOquery
- TODO- Returns:
- TODO
-
getProperties
INTERNAL: used as a temporary store for custom SDK usage- Returns:
- TODO
-
getProperty
ADVANCED: Allow user defined properties.- Parameters:
property
- TODO- Returns:
- TODO
-
getRealAttributeValueFromObject
public Object getRealAttributeValueFromObject(Object object, AbstractSession session) throws DescriptorException INTERNAL: Return the value of an attribute unwrapping value holders if required.- Throws:
DescriptorException
-
getRealAttributeValueFromAttribute
public Object getRealAttributeValueFromAttribute(Object attributeValue, Object object, AbstractSession session) throws DescriptorException INTERNAL: Return the value of an attribute unwrapping value holders if required.- Throws:
DescriptorException
-
instantiateAttribute
INTERNAL: Trigger the instantiation of the attribute if lazy. -
isAttributeValueFromObjectInstantiated
INTERNAL: Return whether the specified object is instantiated. -
getRealCollectionAttributeValueFromObject
public Object getRealCollectionAttributeValueFromObject(Object object, AbstractSession session) throws DescriptorException INTERNAL: Return the value of an attribute, unwrapping value holders if necessary. If the value is null, build a new container.- Throws:
DescriptorException
-
getReferenceDescriptor
PUBLIC: Return the referenceDescriptor. This is a descriptor which is associated with the reference class.- Specified by:
getReferenceDescriptor
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
getRelationshipPartner
INTERNAL: Return the relationshipPartner mapping for this bi-directional mapping. If the relationshipPartner is null then this is a uni-directional mapping. -
getSetMethodName
PUBLIC: This method is invoked reflectively on the reference object to set the value of the attribute in the object. This method returns the name of the setMethodName or null if not using method access. -
getUnconvertedProperties
INTERNAL: Used to store un-converted properties, which are subsequenctly converted at runtime (through the convertClassNamesToClasses method. -
getValueFromRemoteValueHolder
INTERNAL: extract and return the appropriate value from the specified remote value holder -
getWeight
INTERNAL: Return the weight of the mapping, used to sort mappings to ensure that DirectToField Mappings get merged first -
hasConstraintDependency
public boolean hasConstraintDependency()INTERNAL: The returns if the mapping has any constraint dependencies, such as foreign keys and join tables. -
isUsingMethodAccess
public boolean isUsingMethodAccess()PUBLIC: Return if method access is used. -
hasDependency
public boolean hasDependency()INTERNAL: Return if the mapping has any ownership or other dependency over its target object(s). -
hasInverseConstraintDependency
public boolean hasInverseConstraintDependency()INTERNAL: The returns if the mapping has any inverse constraint dependencies, such as foreign keys and join tables. -
initialize
INTERNAL: Allow for initialization of properties and validation.- Throws:
DescriptorException
-
isAggregateCollectionMapping
public boolean isAggregateCollectionMapping()INTERNAL: Related mapping should implement this method to return true. -
isAggregateMapping
public boolean isAggregateMapping()INTERNAL: Related mapping should implement this method to return true. -
isAggregateObjectMapping
public boolean isAggregateObjectMapping()INTERNAL: Related mapping should implement this method to return true. -
isCollectionMapping
public boolean isCollectionMapping()INTERNAL: Related mapping should implement this method to return true.- Specified by:
isCollectionMapping
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
isDatabaseMapping
public boolean isDatabaseMapping()INTERNAL: -
isDirectCollectionMapping
public boolean isDirectCollectionMapping()INTERNAL: Related mapping should implement this method to return true. -
isDirectMapMapping
public boolean isDirectMapMapping()INTERNAL: Related mapping should implement this method to return true. -
isDirectToFieldMapping
public boolean isDirectToFieldMapping()INTERNAL: Related mapping should implement this method to return true.- Specified by:
isDirectToFieldMapping
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
isElementCollectionMapping
public boolean isElementCollectionMapping()INTERNAL: Related mapping should implement this method to return true. -
isForeignReferenceMapping
public boolean isForeignReferenceMapping()INTERNAL: Related mapping should implement this method to return true. -
isLockableMapping
public boolean isLockableMapping()INTERNAL: Return whether this mapping should be traversed when we are locking -
isManyToManyMapping
public boolean isManyToManyMapping()INTERNAL: Related mapping should implement this method to return true. -
isMapKeyMapping
public boolean isMapKeyMapping()- Returns:
- the isMapKeyMapping
-
isMultitenantPrimaryKeyMapping
public boolean isMultitenantPrimaryKeyMapping()INTERNAL -
setIsMapKeyMapping
public void setIsMapKeyMapping(boolean isMapKeyMapping) - Parameters:
isMapKeyMapping
- the isMapKeyMapping to set
-
isNestedTableMapping
public boolean isNestedTableMapping()INTERNAL: Related mapping should implement this method to return true. -
isObjectReferenceMapping
public boolean isObjectReferenceMapping()INTERNAL: Related mapping should implement this method to return true. -
isOneToManyMapping
public boolean isOneToManyMapping()INTERNAL: Related mapping should implement this method to return true. -
isOneToOneMapping
public boolean isOneToOneMapping()INTERNAL: Related mapping should implement this method to return true. -
isManyToOneMapping
public boolean isManyToOneMapping()INTERNAL: Related mapping should implement this method to return true. -
isOptional
public boolean isOptional()Return whether the value of this mapping is optional (that is, can be null). This is a hint and is used when generating DDL. -
isOwned
public boolean isOwned()Returns true if this mapping is owned by the parent descriptor. This is generally based on mapping type -
isJPAId
public boolean isJPAId()INTERNAL: Flags that this mapping is part of a JPA id mapping. It should be temporary though, as the CMP3Policy should be able to figure things out on its own. The problem being that the JPA mapped superclass descriptors are not initialized and do not have a CMP3Policy set by default. -
isLazy
public boolean isLazy()Return if this mapping is lazy. Lazy has different meaning for different mappings. For basic/direct mappings, this can be used exclude it from the descriptor's default fetch group. This means that queries will not include the field(s) required by this mapping by default. This can only be used if the descriptor has a FetchGroupManager and class implements the FetchGroupTracker interface (or is weaved).For relationship mappings this should normally be the same value as indirection, however for eager relationships this can be used with indirection to allow indirection locking and change tracking, but still always force instantiation.
-
setIsJPAId
public void setIsJPAId()INTERNAL: Flags that this mapping is part of a JPA id mapping. It should be temporary though, as the CMP3Policy should be able to figure things out on its own. The problem being that the JPA mapped superclass descriptors are not initialized and do not have a CMP3Policy set by default. -
setIsLazy
public void setIsLazy(boolean isLazy) Set if this mapping is lazy. This can be used for any mapping type to exclude it from the descriptor's default fetch group. This means that queries will not include the field(s) required by this mapping by default. This can only be used if the descriptor has a FetchGroupManager and class implements the FetchGroupTracker interface (or is weaved). This is not the same as indirection on relationships (lazy relationships), as it defers the loading of the source object fields, not the relationship. -
isEISMapping
public boolean isEISMapping()INTERNAL: All EIS mappings should implement this method to return true. -
isRelationalMapping
public boolean isRelationalMapping()INTERNAL: All relational mappings should implement this method to return true. -
isXMLMapping
public boolean isXMLMapping()INTERNAL: All relational mappings should implement this method to return true. -
isAbstractDirectMapping
public boolean isAbstractDirectMapping()INTERNAL: Related mapping should implement this method to return true.- Specified by:
isAbstractDirectMapping
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
isAbstractColumnMapping
public boolean isAbstractColumnMapping()INTERNAL: -
isAbstractCompositeDirectCollectionMapping
public boolean isAbstractCompositeDirectCollectionMapping()INTERNAL: Related mapping should implement this method to return true.- Specified by:
isAbstractCompositeDirectCollectionMapping
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
isAbstractCompositeObjectMapping
public boolean isAbstractCompositeObjectMapping()INTERNAL: Related mapping should implement this method to return true.- Specified by:
isAbstractCompositeObjectMapping
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
isAbstractCompositeCollectionMapping
public boolean isAbstractCompositeCollectionMapping()INTERNAL: Related mapping should implement this method to return true.- Specified by:
isAbstractCompositeCollectionMapping
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
isJoiningSupported
public boolean isJoiningSupported()INTERNAL: Return if this mapping support joining. -
isCloningRequired
public boolean isCloningRequired()INTERNAL: Return if this mapping requires its attribute value to be cloned. -
isPrimaryKeyMapping
public boolean isPrimaryKeyMapping()INTERNAL: Set by the Object builder during initialization returns true if this mapping is used as a primary key mapping. -
isCandidateForPrivateOwnedRemoval
public boolean isCandidateForPrivateOwnedRemoval()INTERNAL: Returns true if the mapping should be added to the UnitOfWork's list of private owned objects for private owned orphan removal. -
isCascadedLockingSupported
public boolean isCascadedLockingSupported()INTERNAL: Used when determining if a mapping supports cascaded version optimistic locking. -
isChangeTrackingSupported
INTERNAL: Return if this mapping supports change tracking. -
isPrivateOwned
public boolean isPrivateOwned()INTERNAL: Return if the mapping has ownership over its target object(s). -
isCacheable
public boolean isCacheable()Used to signal that this mapping references a protected/isolated entity and requires special merge/object building behaviour. -
setIsCacheable
public void setIsCacheable(boolean cacheable) Used to signal that this mapping references a protected/isolated entity and requires special merge/object building behaviour. -
isReadOnly
public boolean isReadOnly()INTERNAL: Returns true if mapping is read only else false.- Specified by:
isReadOnly
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
isReferenceMapping
public boolean isReferenceMapping()INTERNAL: Related mapping should implement this method to return true.- Specified by:
isReferenceMapping
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
isRemotelyInitialized
protected boolean isRemotelyInitialized() -
isStructureMapping
public boolean isStructureMapping()INTERNAL: Related mapping should implement this method to return true. -
isTransformationMapping
public boolean isTransformationMapping()INTERNAL: Related mapping should implement this method to return true.- Specified by:
isTransformationMapping
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
isUnidirectionalOneToManyMapping
public boolean isUnidirectionalOneToManyMapping()INTERNAL: -
isVariableOneToOneMapping
public boolean isVariableOneToOneMapping()INTERNAL: Related mapping should implement this method to return true. -
isDirectToXMLTypeMapping
public boolean isDirectToXMLTypeMapping()INTERNAL: Related mapping should implement this method to return true. -
isWriteOnly
public boolean isWriteOnly()INTERNAL: Some mappings support no attribute (transformation and multitenant primary key).- Specified by:
isWriteOnly
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Returns:
- TODO
-
iterate
INTERNAL: Iterate on the appropriate attribute value. -
iterateOnRealAttributeValue
INTERNAL: Iterate on the attribute value. The value holder has already been processed. -
load
public void load(Object object, AttributeItem item, AbstractSession session, boolean fromFetchGroup) Force instantiation of the load group. -
loadAll
Force instantiation of all indirections. -
mergeChangesIntoObject
public abstract void mergeChangesIntoObject(Object target, ChangeRecord changeRecord, Object source, MergeManager mergeManager, AbstractSession targetSession) INTERNAL: Merge changes from the source to the target object. -
mergeIntoObject
public abstract void mergeIntoObject(Object target, boolean isTargetUninitialized, Object source, MergeManager mergeManager, AbstractSession targetSession) INTERNAL: Merge changes from the source to the target object. -
performDataModificationEvent
public void performDataModificationEvent(Object[] event, AbstractSession session) throws DatabaseException, DescriptorException INTERNAL: Perform the commit event. This is used in the uow to delay data modifications.- Throws:
DatabaseException
DescriptorException
-
postDelete
INTERNAL: A subclass should implement this method if it wants different behavior. Recurse thru the parts to delete the reference objects after the actual object is deleted.- Throws:
DatabaseException
-
postInitialize
INTERNAL: Allow for initialization of properties and validation that have dependecies no the descriptor being initialized.- Throws:
DescriptorException
-
postInsert
INTERNAL: A subclass should implement this method if it wants different behavior. Recurse thru the parts to insert the reference objects after the actual object is inserted.- Throws:
DatabaseException
-
postUpdate
INTERNAL: A subclass should implement this method if it wants different behavior. Recurse thru the parts to update the reference objects after the actual object is updated.- Throws:
DatabaseException
-
preDelete
INTERNAL: A subclass should implement this method if it wants different behavior. Recurse thru the parts to delete the reference objects before the actual object is deleted.- Throws:
DatabaseException
-
preInitialize
INTERNAL: Allow for initialization of properties and validation.- Throws:
DescriptorException
-
preInsert
INTERNAL: A subclass should implement this method if it wants different behavior. Recurse thru the parts to insert the reference objects before the actual object is inserted.- Throws:
DatabaseException
-
prepareCascadeLockingPolicy
public void prepareCascadeLockingPolicy()INTERNAL: A subclass that supports cascade version optimistic locking should implement this method to properly prepare the locking policy for their mapping type. -
preUpdate
INTERNAL: A subclass should implement this method if it wants different behavior. Recurse thru the parts to update the reference objects before the actual object is updated.- Throws:
DatabaseException
-
readFromRowIntoObject
public Object readFromRowIntoObject(AbstractRecord databaseRow, JoinedAttributeManager joinManager, Object targetObject, CacheKey parentCacheKey, ObjectBuildingQuery sourceQuery, AbstractSession executionSession, boolean isTargetProtected) throws DatabaseException INTERNAL: Extract value from the row and set the attribute to this value in the object. return value as this value will have been converted to the appropriate type for the object.- Throws:
DatabaseException
-
readFromResultSetIntoObject
public Object readFromResultSetIntoObject(ResultSet resultSet, Object targetObject, ObjectBuildingQuery query, AbstractSession session, DatabaseAccessor accessor, ResultSetMetaData metaData, int columnNumber, DatabasePlatform platform) throws SQLException INTERNAL: Extract values directly from the result-set. PERF: This is used for optimized object building directly from the result-set.- Throws:
SQLException
-
readOnly
public void readOnly()PUBLIC: To make mapping read only. Read-only mappings can be used if two attributes map to the same field. Read-only mappings cannot be used for the primary key or other required fields. -
readWrite
public void readWrite()PUBLIC: The mapping can be dynamically made either readOnly or readWriteOnly. This makes mapping go back to default mode. -
rehashFieldDependancies
INTERNAL: Rehash any hashtables based on fields. This is used to clone descriptors for aggregates, which hammer field names, it is probably better not to hammer the field name and this should be refactored. -
remoteInitialization
INTERNAL: Once descriptors are serialized to the remote session. All its mappings and reference descriptors are traversed. Usually mappings are initilaized and serialized reference descriptors are replaced with local descriptors if they already exist on the remote session. -
remotelyInitialized
protected void remotelyInitialized()Set the mapping to be initialized for the remote session. -
replaceValueHoldersIn
INTERNAL: replace the value holders in the specified reference object(s) -
setAttributeAccessor
ADVANCED: Set the attributeAccessor. The attribute accessor is responsible for setting and retrieving the attribute value from the object for this mapping. This can be set to an implementor of AttributeAccessor if the attribute requires advanced conversion of the mapping value, or a real attribute does not exist.- Specified by:
setAttributeAccessor
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Parameters:
attributeAccessor
- TODO
-
setAttributeName
PUBLIC: Sets the name of the attribute in the mapping.- Specified by:
setAttributeName
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Parameters:
attributeName
- TODO
-
setAttributeValueInObject
INTERNAL: Set the value of the attribute mapped by this mapping.- Specified by:
setAttributeValueInObject
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Parameters:
object
- TODOvalue
- TODO- Throws:
DescriptorException
-
setRealAttributeValueInObject
INTERNAL: Set the value of the attribute mapped by this mapping, placing it inside a value holder if necessary.- Throws:
DescriptorException
-
setDescriptor
INTERNAL: Set the descriptor to which this mapping belongs- Specified by:
setDescriptor
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Parameters:
descriptor
- TODO
-
setFields
INTERNAL: Set the mapping's field collection.- Specified by:
setFields
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Parameters:
fields
- TODO
-
setGetMethodName
PUBLIC: This method is invoked reflectively on the reference object to return the value of the attribute in the object. This method sets the name of the getMethodName. -
setIsOptional
public void setIsOptional(boolean isOptional) Used to specify whether the value of this mapping may be null. This is used when generating DDL. -
setIsPrimaryKeyMapping
public void setIsPrimaryKeyMapping(boolean isPrimaryKeyMapping) INTERNAL: Set by the Object builder during initialization returns true if this mapping is used as a primary key mapping. -
setIsReadOnly
public void setIsReadOnly(boolean aBoolean) PUBLIC: Set this mapping to be read only. Read-only mappings can be used if two attributes map to the same field. Read-only mappings cannot be used for the primary key or other required fields. -
setMapsIdValue
ADVANCED: Set the maps id value -
setProperties
INTERNAL: Allow user defined properties. -
setProperty
ADVANCED: Allow user defined properties. -
setSetMethodName
PUBLIC: Set the methodName used to set the value for the mapping's attribute into the object. -
setWeight
ADVANCED: Set the weight of the mapping, used to sort mappings DirectToField Mappings have a default weight of 1 while all other Mappings have a default weight of MAXINT. Ordering of Mappings can be achieved by setting the weight of a particular mapping to a value within the above mentioned limits. By ordering mappings the user can control what order relationships are processed by TopLink. -
simpleAddToCollectionChangeRecord
public void simpleAddToCollectionChangeRecord(Object referenceKey, Object changeSetToAdd, ObjectChangeSet changeSet, AbstractSession session) throws DescriptorException ADVANCED: This method is used to add an object to a collection once the changeSet is applied. The referenceKey parameter should only be used for direct Maps.- Throws:
DescriptorException
-
simpleRemoveFromCollectionChangeRecord
public void simpleRemoveFromCollectionChangeRecord(Object referenceKey, Object changeSetToAdd, ObjectChangeSet changeSet, AbstractSession session) throws DescriptorException ADVANCED: This method is used to remove an object from a collection once the changeSet is applied. The referenceKey parameter should only be used for direct Maps.- Throws:
DescriptorException
-
toString
INTERNAL: Print the mapping attribute name, this is used in error messages. -
validateAfterInitialization
INTERNAL: Allow for subclasses to perform validation.- Throws:
DescriptorException
-
validateBeforeInitialization
INTERNAL: Allow for subclasses to perform validation.- Throws:
DescriptorException
-
valueFromObject
INTERNAL: A subclass should extract the value from the object for the field, if it does not map the field then it should return null. Return the Value from the object.- Specified by:
valueFromObject
in classCoreMapping<AttributeAccessor,
AbstractSession, ContainerPolicy, ClassDescriptor, DatabaseField> - Parameters:
anObject
- TODOfield
- TODOsession
- TODO- Returns:
- TODO
-
valueFromRow
public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, boolean isTargetProtected) throws DatabaseException INTERNAL: A subclass should implement this method if it wants different behavior. Returns the value for the mapping from the database row.- Throws:
DatabaseException
-
valueFromRow
public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, CacheKey cacheKey, AbstractSession session, boolean isTargetProtected, Boolean[] wasCacheUsed) throws DatabaseException INTERNAL: A subclass should implement this method if it wants different behavior. Returns the value for the mapping from the database row. The execution session is the session the query was executed on, and its platform should be used for data conversion.- Throws:
DatabaseException
-
isInSopObject
public boolean isInSopObject()INTERNAL: Indicates whether the mapping is in SerializedObjectPolicy's sopObject. -
isInOnlySopObject
public boolean isInOnlySopObject()INTERNAL: Indicates whether the mapping is in SerializedObjectPolicy's sopObject and not out of it. -
isOutSopObject
public boolean isOutSopObject()INTERNAL: Indicates whether the mapping is out of SerializedObjectPolicy's sopObject. -
isOutOnlySopObject
public boolean isOutOnlySopObject()INTERNAL: Indicates whether the mapping is out of SerializedObjectPolicy's sopObject and not in it. -
isInAndOutSopObject
public boolean isInAndOutSopObject()INTERNAL: Indicates whether the mapping is both in and out of SerializedObjectPolicy's sopObject. -
setIsInSopObject
public void setIsInSopObject()INTERNAL: Set the mapping is in SerializedObjectPolicy's sopObject. -
setIsOutSopObject
public void setIsOutSopObject()INTERNAL: Set the mapping is out of SerializedObjectPolicy's sopObject. -
setIsInAndOutSopObject
public void setIsInAndOutSopObject()INTERNAL: Set the mapping is both in and out of SerializedObjectPolicy's sopObject -
hasNestedIdentityReference
public boolean hasNestedIdentityReference()INTERNAL: Indicates whether the mapping (or at least one of its nested mappings, at any nested depth) references an entity. To return true the mapping (or nested mapping) should be ForeignReferenceMapping with non-null and non-aggregate reference descriptor. -
valueFromResultSet
public Object valueFromResultSet(ResultSet resultSet, ObjectBuildingQuery query, AbstractSession session, DatabaseAccessor accessor, ResultSetMetaData metaData, int columnNumber, DatabasePlatform platform) throws SQLException INTERNAL: Returns the value for the mapping directly from the result-set. PERF: Used for optimized object building.- Throws:
SQLException
-
verifyDelete
INTERNAL: To verify if the specified object has been deleted or not.- Throws:
DatabaseException
-
writeFromAttributeIntoRow
public void writeFromAttributeIntoRow(Object attribute, AbstractRecord row, AbstractSession session) INTERNAL: A subclass should implement this method if it wants different behavior. Write the foreign key values from the attribute to the row. -
writeFromObjectIntoRow
public void writeFromObjectIntoRow(Object object, AbstractRecord row, AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL: A subclass should implement this method if it wants different behavior. Write the attribute value from the object to the row. -
writeFromObjectIntoRowForShallowInsert
public void writeFromObjectIntoRowForShallowInsert(Object object, AbstractRecord row, AbstractSession session) INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts. If mapping overrides this method it must override writeFromObjectIntoRowForUpdateAfterShallowInsert method, too. -
writeFromObjectIntoRowForUpdateAfterShallowInsert
public void writeFromObjectIntoRowForUpdateAfterShallowInsert(Object object, AbstractRecord databaseRow, AbstractSession session, DatabaseTable table) INTERNAL: This row is built for update after shallow insert which happens in case of bidirectional inserts. It contains the foreign keys with non null values that were set to null for shallow insert. If mapping overrides writeFromObjectIntoRowForShallowInsert method it must override this one, too. -
writeFromObjectIntoRowForUpdateBeforeShallowDelete
public void writeFromObjectIntoRowForUpdateBeforeShallowDelete(Object object, AbstractRecord databaseRow, AbstractSession session, DatabaseTable table) INTERNAL: This row is built for update before shallow delete which happens in case of bidirectional inserts. It contains the same fields as the row built by writeFromObjectIntoRowForUpdateAfterShallowInsert, but all the values are null. -
writeFromObjectIntoRowWithChangeRecord
public void writeFromObjectIntoRowWithChangeRecord(ChangeRecord changeRecord, AbstractRecord row, AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL: A subclass should implement this method if it wants different behavior. Write the attribute value from the object to the row. -
writeFromObjectIntoRowForShallowInsertWithChangeRecord
public void writeFromObjectIntoRowForShallowInsertWithChangeRecord(ChangeRecord changeRecord, AbstractRecord row, AbstractSession session) INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts. -
writeFromObjectIntoRowForUpdate
INTERNAL: -
writeFromObjectIntoRowForWhereClause
INTERNAL: A subclass should implement this method if it wants different behavior. Write the attribute value from the object to the row. -
writeInsertFieldsIntoRow
INTERNAL: Write fields needed for insert into the template for with null values. -
writeUpdateFieldsIntoRow
INTERNAL: Write fields needed for update into the template for with null values. By default inserted fields are used. -
updateChangeRecord
public void updateChangeRecord(Object clone, Object newValue, Object oldValue, ObjectChangeSet objectChangeSet, UnitOfWorkImpl uow) throws DescriptorException INTERNAL: Either create a new change record or update the change record with the new value. This is used by attribute change tracking.- Throws:
DescriptorException
-
updateCollectionChangeRecord
public void updateCollectionChangeRecord(CollectionChangeEvent event, ObjectChangeSet objectChangeSet, UnitOfWorkImpl uow) throws DescriptorException INTERNAL: Add or removes a new value and its change set to the collection change record based on the event passed in. This is used by attribute change tracking.- Throws:
DescriptorException
-
setChangeListener
INTERNAL: Set the change listener if required. This is required for collections and aggregates or other change tracked mutable objects. This is used for resuming or flushing units of work. -
setDerivesId
public void setDerivesId(boolean derivesId) ADVANCED: Used to indicate the mapping references a JPA ID or MapsId attribute for the CMP3Policy and JPA Id classes (as well as Embeddable Id classes). This is different from isPrimaryKeyMapping, as an ID mapping is user specified and can be read only, as long as another writable mapping for the field exists. -
setDerivedIdMapping
ADVANCED: Used to indicate the mapping references a JPA ID or MapsId attribute for the CMP3Policy and JPA Id classes (as well as Embeddable Id classes). This is different from isPrimaryKeyMapping, as an ID mapping is user specified and can be read only, as long as another writable mapping for the field exists. -
buildChangeRecord
public ChangeRecord buildChangeRecord(Object newValue, ObjectChangeSet owner, AbstractSession session) throws DescriptorException INTERNAL: Directly build a change record without comparison- Throws:
DescriptorException
-
postCalculateChanges
INTERNAL: Overridden by mappings that require additional processing of the change record after the record has been calculated. -
postCalculateChangesOnDeleted
public void postCalculateChangesOnDeleted(Object deletedObject, UnitOfWorkChangeSet uowChangeSet, UnitOfWorkImpl uow) INTERNAL: Overridden by mappings that require objects to be deleted contribute to change set creation. -
recordPrivateOwnedRemovals
INTERNAL: Overridden by mappings that require objects to be deleted contribute to change set creation.
-