Class AggregateObjectMapping
- All Implemented Interfaces:
Serializable
,Cloneable
,EmbeddableMapping
,MapComponentMapping
,MapKeyMapping
,RelationalMapping
Purpose:Two objects can be considered to be related by aggregation if there is a strict 1:1 relationship between the objects. This means that the target (child or owned) object cannot exist without the source (parent) object. In TopLink, it also means the data for the owned object is stored in the same table as the parent.
- Since:
- TOPLink/Java 1.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.persistence.mappings.DatabaseMapping
DatabaseMapping.WriteType
-
Field Summary
Modifier and TypeFieldDescriptionprotected DatabaseTable
protected Map
<String, DatabaseField> 322233 - changed to store the source DatabaseField to hold Case and other colunm infoList of converters to apply at initialize time to their cloned aggregate mappings.protected boolean
If all the fields in the database row for the aggregate object are NULL, then, by default, the mapping will place a null in the appropriate source object (as opposed to an aggregate object filled with nulls).protected List
<DatabaseMapping> List of maps id mappings that need to be set to read only at initialize time on their cloned aggregate mappings.Map of nested attributes that need to apply an override name to their a nested aggregate mapping's database field.protected List
<ManyToManyMapping> List of many to many mapping overrides to apply at initialize time to their cloned aggregate mappings.protected List
<UnidirectionalOneToManyMapping> List of unidirectional one to many mapping overrides to apply at initialize time to their cloned aggregate mappings.Fields inherited from class org.eclipse.persistence.mappings.AggregateMapping
hasNestedIdentityReference, referenceClass, referenceClassName, referenceDescriptor
Fields inherited from class org.eclipse.persistence.mappings.DatabaseMapping
attributeAccessor, attributeName, derivedIdMapping, derivesId, descriptor, fields, isCacheable, isInSopObject, isJPAId, isLazy, isMapKeyMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isRemotelyInitialized, mapsIdValue, NO_FIELDS, NO_WEIGHT, properties, unconvertedProperties, weight, WEIGHT_AGGREGATE, WEIGHT_DIRECT, WEIGHT_TO_ONE, WEIGHT_TRANSFORM
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAdditionalFieldsToQuery
(ReadQuery selectionQuery, Expression baseExpression) INTERNAL: Used when initializing queries for mappings that use a Map Called when the selection query is being initialized to add the fields for the map key to the queryvoid
addConverter
(Converter converter, String attributeName) Add a converter to be applied to a mapping of the aggregate descriptor.void
addFieldNameTranslation
(String sourceFieldName, String aggregateFieldName) PUBLIC: Add a field name translation that maps from a field name in the source table to a field name in the aggregate descriptor.void
addFieldsForMapKey
(AbstractRecord joinRow) INTERNAL: Used when initializing queries for mappings that use a Map Called when the insert query is being initialized to ensure the fields for the map key are in the insert queryvoid
addFieldTranslation
(DatabaseField sourceField, String aggregateFieldName) PUBLIC: Add a field translation that maps from a field in the source table to a field name in the aggregate descriptor.void
addKeyToDeletedObjectsList
(Object object, Map deletedObjects) INTERNAL: For mappings used as MapKeys in MappedKeyContainerPolicy.void
addMapsIdMapping
(DatabaseMapping mapping) INTERNAL: In JPA users may specify a maps id mapping on a shared embeddable descriptor.void
addNestedFieldTranslation
(String attributeName, DatabaseField sourceField, String aggregateFieldName) INTERNAL: Add a nested field translation that maps from a field in the source table to a field name in a nested aggregate descriptor.void
INTERNAL: In JPA users may specify overrides to apply to a many to many mapping on a shared embeddable descriptor.void
INTERNAL: In JPA users may specify overrides to apply to a unidirectional one to many mapping on a shared embeddable descriptor.void
addPrimaryKeyJoinField
(DatabaseField primaryKeyField, DatabaseField secondaryField) INTERNAL: Add a primary key join column (secondary field).protected boolean
allAggregateFieldsAreNull
(AbstractRecord databaseRow) INTERNAL: Return whether all the aggregate fields in the specified row are NULL.void
PUBLIC: If all the fields in the database row for the aggregate object are NULL, then, by default, the mapping will place a null in the appropriate source object (as opposed to an aggregate object filled with nulls).protected boolean
INTERNAL: Return whether the query's backup object has an attribute value of null.buildAggregateFromRow
(AbstractRecord databaseRow, Object targetObject, CacheKey cacheKey, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, boolean buildShallowOriginal, AbstractSession executionSession, boolean targetIsProtected) INTERNAL: Build and return an aggregate object from the specified row.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.void
buildCloneFromRow
(AbstractRecord databaseRow, JoinedAttributeManager joinManager, Object clone, CacheKey sharedCacheKey, ObjectBuildingQuery sourceQuery, UnitOfWorkImpl unitOfWork, AbstractSession executionSession) INTERNAL: A combination of readFromRowIntoObject and buildClone.buildElementClone
(Object attributeValue, Object parent, CacheKey parentCacheKey, Integer refreshCascade, AbstractSession cloningSession, boolean isExisting, boolean isFromSharedCache) INTERNAL: Build a clone of the given element in a unitOfWorkbuildObjectJoinExpression
(Expression expression, Object value, AbstractSession session) INTERNAL: Used to allow object level comparisons.buildObjectJoinExpression
(Expression expression, Expression argument, AbstractSession session) INTERNAL: Used to allow object level comparisons.buildSelectionQueryForDirectCollectionKeyMapping
(ContainerPolicy containerPolicy) INTERNAL: Certain key mappings favor different types of selection query.void
buildShallowOriginalFromRow
(AbstractRecord databaseRow, Object original, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, AbstractSession executionSession) INTERNAL: Builds a shallow original object.protected AbstractRecord
buildTemplateInsertRow
(AbstractSession session) INTERNAL: Build and return a "template" database row with all the fields set to null.protected CacheKey
buildWrapperCacheKeyForAggregate
(CacheKey owningCacheKey, boolean targetIsProtected) INTERNAL: Wrap the aggregate represented by this mapping in a cachekey so it can be processed my methods down the stack.void
cascadeDiscoverAndPersistUnregisteredNewObjects
(Object object, Map newObjects, Map unregisteredExistingObjects, Map visitedObjects, UnitOfWorkImpl uow, boolean getAttributeValueFromObject, Set cascadeErrors) INTERNAL: Cascade discover and persist new objects during commit to the map keyvoid
cascadePerformRemoveIfRequired
(Object object, UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade perform delete through mappings that require the cascadevoid
cascadePerformRemoveIfRequired
(Object object, UnitOfWorkImpl uow, Map visitedObjects, boolean getAttributeValueFromObject) INTERNAL: Cascade perform delete through mappings that require the cascadevoid
cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired
(Object object, UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade perform removal of orphaned private owned objects from the UnitOfWorkChangeSetvoid
cascadeRegisterNewIfRequired
(Object object, UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade registerNew for Create through mappings that require the cascadevoid
cascadeRegisterNewIfRequired
(Object object, UnitOfWorkImpl uow, Map visitedObjects, boolean getAttributeValueFromObject) INTERNAL: Cascade registerNew for Create through mappings that require the cascadeclone()
INTERNAL: Clone the aggregate to source field names.protected Vector
<DatabaseField> INTERNAL: Return the fields handled by the mapping.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 entityvoid
convertClassNamesToClasses
(ClassLoader classLoader) INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings.createMapComponentFromJoinedRow
(AbstractRecord dbRow, JoinedAttributeManager joinManger, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected) INTERNAL Called when a DatabaseMapping is used to map the key in a collection and a join query is executed.createMapComponentFromRow
(AbstractRecord dbRow, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected) INTERNAL Called when a DatabaseMapping is used to map the key in a collection.createMapComponentsFromSerializableKeyInfo
(Object[] keyInfo, AbstractSession session) INTERNAL: Create an instance of the Key object from the key information extracted from the map.INTERNAL: Create a query key that links to the map keycreateSerializableMapKeyInfo
(Object key, AbstractSession session) INTERNAL: Creates the Array of simple types used to recreate this map.createStubbedMapComponentFromSerializableKeyInfo
(Object keyInfo, AbstractSession session) INTERNAL: Create an instance of the Key object from the key information extracted from the map.void
deleteMapKey
(Object objectDeleted, AbstractSession session) INTERNAL: For mappings used as MapKeys in MappedKeyContainerPolicy, Delete the passed object if necessary.void
PUBLIC: If all the fields in the database row for the aggregate object are NULL, then, by default, the mapping will place a null in the appropriate source object (as opposed to an aggregate object filled with nulls).void
earlyPreDelete
(DeleteObjectQuery query, Object object) INTERNAL: This method is called to update collection tables prior to commit.extractIdentityFieldsForQuery
(Object object, AbstractSession session) INTERNAL: Extract the fields for the Map key from the object to use in a query.INTERNAL: Return the selection criteria necessary to select the target object when this mapping is a map key.INTERNAL: Return any tables that will be required when this mapping is used as part of a join queryINTERNAL: Return a collection of the aggregate to source field associations.INTERNAL: Return the hashtable that stores aggregate field name to source fields.INTERNAL: Get all the fields for the map keyClass
<?> PUBLIC: The classification type for the attribute this mapping representsClass
<?> getFieldClassification
(DatabaseField fieldToClassify) INTERNAL: Return the classification for the field contained in the mapping.INTERNAL: Return a Map of any foreign keys defined within the the MapKeyINTERNAL: Return the fields that make up the identity of the mapped object.INTERNAL: Return the class this key mapping maps or the descriptor for itprotected Object
getMatchingAttributeValueFromObject
(AbstractRecord row, Object targetObject, AbstractSession session, ClassDescriptor descriptor) INTERNAL: This is used to preserve object identity during a refreshObject() query.protected Object
getMatchingBackupAttributeValue
(WriteObjectQuery query, Object attributeValue) INTERNAL: This is used to match up objects during an update in a UOW.INTERNAL: Return the hashtable that stores the nested field translations.getNestedJoinQuery
(JoinedAttributeManager joinManager, ObjectLevelReadQuery query, AbstractSession session) INTERNAL: Return the query that is used when this mapping is part of a joined relationship This method is used when this mapping is used to map the key in a MapINTERNAL: Aggregate order by all their fields by default.getReferenceDescriptor
(Class<?> theClass, AbstractSession session) INTERNAL: Since aggregate object mappings clone their descriptors, for inheritance the correct child clone must be found.protected Vector
<DatabaseField> INTERNAL: Return the fields used to build the aggregate object.getTargetVersionOfSourceObject
(Object object, Object parent, MergeManager mergeManager, AbstractSession targetSession) INTERNAL: If required, get the targetVersion of the source object from the merge manager.boolean
INTERNAL: Return if the mapping has any ownership or other dependency over its target object(s).void
initialize
(AbstractSession session) INTERNAL: For an aggregate mapping the reference descriptor is cloned.void
initializeChildInheritance
(ClassDescriptor parentDescriptor, AbstractSession session) INTERNAL: For an aggregate mapping the reference descriptor is cloned.void
initializeParentInheritance
(ClassDescriptor parentDescriptor, ClassDescriptor childDescriptor, AbstractSession session) INTERNAL: For an aggregate mapping the reference descriptor is cloned.protected void
initializeReferenceDescriptor
(ClassDescriptor clonedDescriptor, AbstractSession session) INTERNAL: Initialize the cloned reference descriptor with table names and primary keysboolean
INTERNAL: Related mapping should implement this method to return true.boolean
INTERNAL Return true if this mapping supports cascaded version optimistic locking.boolean
isChangeTrackingSupported
(Project project) INTERNAL: Return if this mapping supports change tracking.boolean
isJPAIdNested
(AbstractSession session) INTERNAL: Flags that either this mapping or nested mapping is a JPA id mapping.boolean
INTERNAL: Return whether this mapping should be traversed when we are lockingboolean
PUBLIC: Return if all the fields in the database row for the aggregate object are NULL, then, by default, the mapping will place a null in the appropriate source object (as opposed to an aggregate object filled with nulls).boolean
INTERNAL:void
iterateOnMapKey
(DescriptorIterator iterator, Object element) INTERNAL: Called when iterating through descriptors to handle iteration on this mapping when it is used as a MapKeyvoid
postInitialize
(AbstractSession session) INTERNAL: For an aggregate mapping the reference descriptor is cloned.void
INTERNAL: Making any mapping changes necessary to use a the mapping as a map key after initializing the mapping.void
preinitializeMapKey
(DatabaseTable table) INTERNAL: Making any mapping changes necessary to use a the mapping as a map key prior to initializing the mappingprepareNestedQuery
(ObjectBuildingQuery sourceQuery) INTERNAL: Clone and prepare the selection query as a nested batch read query.readFromReturnRowIntoObject
(AbstractRecord row, Object targetObject, ReadObjectQuery query, Collection handledMappings, ObjectChangeSet changeSet) INTERNAL: Build an aggregate object from the specified return row and put it in the specified target object.readFromRowIntoObject
(AbstractRecord databaseRow, JoinedAttributeManager joinManager, Object targetObject, CacheKey parentCacheKey, ObjectBuildingQuery sourceQuery, AbstractSession executionSession, boolean isTargetProtected) INTERNAL: Build an aggregate object from the specified row and put it in the specified target object.void
rehashFieldDependancies
(AbstractSession session) INTERNAL: Rehash any hashtables based on fields.boolean
INTERNAL: Return whether this mapping requires extra queries to update the rows if it is used as a key in a map.void
setAggregateToSourceFieldAssociations
(Vector<Association> fieldAssociations) INTERNAL: Set a collection of the aggregate to source field name associations.void
setAggregateToSourceFields
(Map<String, DatabaseField> aggregateToSource) INTERNAL: Set the hashtable that stores target field name to the source field name.void
setChangeListener
(Object clone, PropertyChangeListener listener, UnitOfWorkImpl uow) INTERNAL: Set the change listener in the aggregate.void
setIsNullAllowed
(boolean isNullAllowed) PUBLIC: Configure if all the fields in the database row for the aggregate object are NULL, then, by default, the mapping will place a null in the appropriate source object (as opposed to an aggregate object filled with nulls).void
setNestedFieldTranslations
(Map<String, Object[]> fieldTranslations) INTERNAL: Set the hashtable that stores a field in the source table to a field name in a nested aggregate descriptor.void
INTERNAL: If this mapping is used as the key of a CollectionTableMapMapping, the table used by this mapping will be the relation table.protected void
translateField
(DatabaseField sourceField, DatabaseField mappingField, ClassDescriptor clonedDescriptor) INTERNAL: Apply the field translation from the sourceField to the mappingField.protected void
translateFields
(ClassDescriptor clonedDescriptor, AbstractSession session) INTERNAL: If field names are different in the source and aggregate objects then the translation is done here.protected void
translateNestedFields
(ClassDescriptor clonedDescriptor, AbstractSession session) INTERNAL: If field names are different in the source and aggregate objects then the translation is done here.unwrapKey
(Object key, AbstractSession session) INTERNAL: Allow the key mapping to unwrap the object.valueFromObject
(Object object, DatabaseField field, AbstractSession session) INTERNAL: Extract value of the field from the objectwrapKey
(Object key, AbstractSession session) INTERNAL: Allow the key mapping to wrap the object.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 databaseRow, AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL: Get the attribute value from the object and add the appropriate values to the specified database row.void
writeFromObjectIntoRowForShallowInsert
(Object object, AbstractRecord row, AbstractSession session) INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts.void
writeFromObjectIntoRowForUpdate
(WriteObjectQuery query, AbstractRecord databaseRow) INTERNAL: Get the attribute value from the object and add the changed values to the specified database row.void
writeFromObjectIntoRowForUpdateAfterShallowInsert
(Object object, AbstractRecord row, 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 row, AbstractSession session, DatabaseTable table) INTERNAL: This row is built for update before shallow delete which happens in case of bidirectional inserts.void
writeFromObjectIntoRowWithChangeRecord
(ChangeRecord changeRecord, AbstractRecord databaseRow, AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL: Get the attribute value from the object and add the appropriate values to the specified database row.void
writeInsertFieldsIntoRow
(AbstractRecord databaseRow, AbstractSession session) INTERNAL: Write fields needed for insert into the template for with null values.protected void
writeNullReferenceRow
(AbstractRecord record) INTERNAL: Write null values for all aggregate fields into the parent row.protected void
writeToRowFromAggregate
(AbstractRecord record, Object object, Object attributeValue, AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL: Write the aggregate values into the parent row.protected void
writeToRowFromAggregateForShallowInsert
(AbstractRecord record, Object object, Object attributeValue, AbstractSession session) INTERNAL: Write the aggregate values into the parent row for shallow insert.protected void
writeToRowFromAggregateForUpdate
(AbstractRecord record, WriteObjectQuery query, Object attributeValue) INTERNAL: Build and return a database row built with the changed values from the specified attribute value.protected void
writeToRowFromAggregateForUpdateAfterShallowInsert
(AbstractRecord record, Object object, Object attributeValue, AbstractSession session, DatabaseTable table) INTERNAL: Write the aggregate values into the parent row for update after shallow insert.protected void
writeToRowFromAggregateForUpdateBeforeShallowDelete
(AbstractRecord record, Object object, Object attributeValue, AbstractSession session, DatabaseTable table) INTERNAL: Write the aggregate values into the parent row for update before shallow delete.protected void
writeToRowFromAggregateWithChangeRecord
(AbstractRecord record, ChangeRecord changeRecord, ObjectChangeSet objectChangeSet, AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL: Build and return a database row built with the values from the specified attribute value.void
writeUpdateFieldsIntoRow
(AbstractRecord databaseRow, AbstractSession session) INTERNAL: Write fields needed for update into the template for with null values.Methods inherited from class org.eclipse.persistence.mappings.AggregateMapping
buildAggregateDeleteQuery, buildAggregateModifyQuery, buildAggregateWriteQuery, buildBackupClone, buildBackupClonePart, buildClonePart, buildClonePart, buildCopy, buildCopyOfAttributeValue, buildExpression, buildNewMergeInstanceOf, compareAttributeValues, compareForChange, compareObjects, executeEvent, fixAttributeValue, fixObjectReferences, getAttributeValueFromBackupClone, getObjectBuilder, getObjectBuilderForClass, getQueryManager, getReferenceClass, getReferenceClassName, getReferenceDescriptor, getReferenceDescriptor, hasNestedIdentityReference, isAggregateMapping, iterate, iterateOnAttributeValue, load, loadAll, mergeAttributeValue, mergeChangesIntoObject, mergeIntoObject, postDelete, postDeleteAttributeValue, postInsert, postInsertAttributeValue, postUpdate, postUpdateAttributeValue, preDelete, preDeleteAttributeValue, preInsert, preInsertAttributeValue, preUpdate, preUpdateAttributeValue, remoteInitialization, setReferenceClass, setReferenceClassName, setReferenceDescriptor, updateChangeRecord, verifyDelete, verifyDeleteOfAttributeValue
Methods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
addUnconvertedProperty, buildBackupCloneForPartObject, buildChangeRecord, buildCloneForPartObject, buildContainerClone, calculateDeferredChanges, cascadeDiscoverAndPersistUnregisteredNewObjects, cloneFields, convertConverterClassNamesToClasses, createCloneValueHolder, derivesId, extractNestedExpressions, extractNestedNonAggregateExpressions, fixRealObjectReferences, getAttributeAccessor, getAttributeName, getAttributeValueFromObject, getContainerPolicy, getDerivedIdMapping, getDescriptor, getField, getFields, getGetMethodName, getMapsIdValue, getObjectCorrespondingTo, getProperties, getProperty, getRealAttributeValueFromAttribute, getRealAttributeValueFromObject, getRealCollectionAttributeValueFromObject, getRelationshipPartner, getSelectFields, getSelectTables, getSetMethodName, getUnconvertedProperties, getValueFromRemoteValueHolder, getWeight, hasConstraintDependency, hasInverseConstraintDependency, hasMapsIdValue, hasRootExpressionThatShouldUseOuterJoin, hasUnconvertedProperties, instantiateAttribute, isAbstractColumnMapping, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAttributeValueFromObjectInstantiated, isCacheable, isCandidateForPrivateOwnedRemoval, isCloningRequired, isCollectionMapping, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isElementCollectionMapping, isForeignReferenceMapping, isInAndOutSopObject, isInOnlySopObject, isInSopObject, isJoiningSupported, isJPAId, isLazy, isManyToManyMapping, isManyToOneMapping, isMapKeyMapping, isMultitenantPrimaryKeyMapping, isNestedTableMapping, isObjectReferenceMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isOutOnlySopObject, isOutSopObject, isOwned, isPrimaryKeyMapping, isPrivateOwned, isReadOnly, isReferenceMapping, isRemotelyInitialized, isStructureMapping, isTransformationMapping, isUnidirectionalOneToManyMapping, isUsingMethodAccess, isVariableOneToOneMapping, isWriteOnly, isXMLMapping, iterateOnRealAttributeValue, performDataModificationEvent, postCalculateChanges, postCalculateChangesOnDeleted, postInitializeSourceAndTargetExpressions, preInitialize, prepareCascadeLockingPolicy, readFromResultSetIntoObject, readOnly, readWrite, recordPrivateOwnedRemovals, remotelyInitialized, replaceValueHoldersIn, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setDerivedIdMapping, setDerivesId, setDescriptor, setFields, setGetMethodName, setIsCacheable, setIsInAndOutSopObject, setIsInSopObject, setIsJPAId, setIsLazy, setIsMapKeyMapping, setIsOptional, setIsOutSopObject, setIsPrimaryKeyMapping, setIsReadOnly, setMapsIdValue, setProperties, setProperty, setRealAttributeValueInObject, setSetMethodName, setWeight, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, toString, updateCollectionChangeRecord, validateAfterInitialization, validateBeforeInitialization, valueFromResultSet, valueFromRow, valueFromRow, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForWhereClause
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.persistence.mappings.EmbeddableMapping
getAttributeName
Methods inherited from interface org.eclipse.persistence.mappings.foundation.MapKeyMapping
getReferenceDescriptor
-
Field Details
-
isNullAllowed
protected boolean isNullAllowedIf all the fields in the database row for the aggregate object are NULL, then, by default, the mapping will place a null in the appropriate source object (as opposed to an aggregate object filled with nulls). To change this behavior, set the value of this variable to false. Then the mapping will build a new instance of the aggregate object that is filled with nulls and place it in the source object. -
aggregateKeyTable
-
aggregateToSourceFields
322233 - changed to store the source DatabaseField to hold Case and other colunm info -
nestedFieldTranslations
Map of nested attributes that need to apply an override name to their a nested aggregate mapping's database field. Aggregate to source fields map is the existing EclipseLink functionality and works well when all embeddable mappings have unique database fields. This map adds specific attribute to database field override.- See Also:
-
overrideManyToManyMappings
List of many to many mapping overrides to apply at initialize time to their cloned aggregate mappings. -
overrideUnidirectionalOneToManyMappings
List of unidirectional one to many mapping overrides to apply at initialize time to their cloned aggregate mappings. -
converters
List of converters to apply at initialize time to their cloned aggregate mappings. -
mapsIdMappings
List of maps id mappings that need to be set to read only at initialize time on their cloned aggregate mappings.
-
-
Constructor Details
-
AggregateObjectMapping
public AggregateObjectMapping()Default constructor.
-
-
Method Details
-
isRelationalMapping
public boolean isRelationalMapping()INTERNAL:- Overrides:
isRelationalMapping
in classDatabaseMapping
-
addAdditionalFieldsToQuery
INTERNAL: Used when initializing queries for mappings that use a Map Called when the selection query is being initialized to add the fields for the map key to the query- Specified by:
addAdditionalFieldsToQuery
in interfaceMapKeyMapping
-
addConverter
Add a converter to be applied to a mapping of the aggregate descriptor.- Specified by:
addConverter
in interfaceEmbeddableMapping
-
addFieldsForMapKey
INTERNAL: Used when initializing queries for mappings that use a Map Called when the insert query is being initialized to ensure the fields for the map key are in the insert query- Specified by:
addFieldsForMapKey
in interfaceMapKeyMapping
-
addFieldNameTranslation
PUBLIC: Add a field name translation that maps from a field name in the source table to a field name in the aggregate descriptor. -
addFieldTranslation
PUBLIC: Add a field translation that maps from a field in the source table to a field name in the aggregate descriptor.- Specified by:
addFieldTranslation
in interfaceEmbeddableMapping
-
addMapsIdMapping
INTERNAL: In JPA users may specify a maps id mapping on a shared embeddable descriptor. These mappings need to be set to read-only at initialize time, after the reference descriptor is cloned. -
addNestedFieldTranslation
public void addNestedFieldTranslation(String attributeName, DatabaseField sourceField, String aggregateFieldName) INTERNAL: Add a nested field translation that maps from a field in the source table to a field name in a nested aggregate descriptor. These are handled slightly different that regular field translations in that they are unique based on the attribute name. It solves the case where multiple nested embeddables have mappings to similarly named default columns.- Specified by:
addNestedFieldTranslation
in interfaceEmbeddableMapping
-
addOverrideManyToManyMapping
INTERNAL: In JPA users may specify overrides to apply to a many to many mapping on a shared embeddable descriptor. These settings are applied at initialize time, after the reference descriptor is cloned.- Specified by:
addOverrideManyToManyMapping
in interfaceEmbeddableMapping
-
addOverrideUnidirectionalOneToManyMapping
INTERNAL: In JPA users may specify overrides to apply to a unidirectional one to many mapping on a shared embeddable descriptor. These settings are applied at initialize time, after the reference descriptor is cloned.- Specified by:
addOverrideUnidirectionalOneToManyMapping
in interfaceEmbeddableMapping
-
addKeyToDeletedObjectsList
INTERNAL: For mappings used as MapKeys in MappedKeyContainerPolicy. Add the target of this mapping to the deleted objects list if necessary This method is used for removal of private owned relationships. AggregateObjectMappings are dealt with in their parent delete, so this is a no-op.- Specified by:
addKeyToDeletedObjectsList
in interfaceMapKeyMapping
-
allAggregateFieldsAreNull
INTERNAL: Return whether all the aggregate fields in the specified row are NULL. -
allowNull
public void allowNull()PUBLIC: If all the fields in the database row for the aggregate object are NULL, then, by default, the mapping will place a null in the appropriate source object (as opposed to an aggregate object filled with nulls). This behavior can be explicitly set by calling #allowNull(). To change this behavior, call #dontAllowNull(). Then the mapping will build a new instance of the aggregate object that is filled with nulls and place it in the source object. In either situation, when writing, the mapping will place a NULL in all the fields in the database row for the aggregate object. Note: Any aggregate that has a relationship mapping automatically does not allow null. -
backupAttributeValueIsNull
INTERNAL: Return whether the query's backup object has an attribute value of null. -
prepareNestedQuery
INTERNAL: Clone and prepare the selection query as a nested batch read query. This is used for nested batch reading. -
buildAggregateFromRow
public Object buildAggregateFromRow(AbstractRecord databaseRow, Object targetObject, CacheKey cacheKey, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, boolean buildShallowOriginal, AbstractSession executionSession, boolean targetIsProtected) throws DatabaseException INTERNAL: Build and return an aggregate object from the specified row. If a null value is allowed and all the appropriate fields in the row are NULL, return a null. If an aggregate is referenced by the target object, return it (maintain identity) Otherwise, simply create a new aggregate object and return it.- Throws:
DatabaseException
-
buildWrapperCacheKeyForAggregate
protected CacheKey buildWrapperCacheKeyForAggregate(CacheKey owningCacheKey, boolean targetIsProtected) INTERNAL: Wrap the aggregate represented by this mapping in a cachekey so it can be processed my methods down the stack.- Parameters:
owningCacheKey
- - the cache key holding the object to extract the aggregate from
-
writeNullReferenceRow
INTERNAL: Write null values for all aggregate fields into the parent row. -
buildObjectJoinExpression
public Expression buildObjectJoinExpression(Expression expression, Object value, AbstractSession session) INTERNAL: Used to allow object level comparisons. In the case of an Aggregate which has no primary key must do an attribute by attribute comparison.- Overrides:
buildObjectJoinExpression
in classDatabaseMapping
- Parameters:
expression
- TODOvalue
- TODOsession
- TODO- Returns:
- TODO
-
buildObjectJoinExpression
public Expression buildObjectJoinExpression(Expression expression, Expression argument, AbstractSession session) INTERNAL: Used to allow object level comparisons.- Overrides:
buildObjectJoinExpression
in classDatabaseMapping
- Parameters:
expression
- TODOargument
- TODOsession
- TODO- Returns:
- TODO
-
writeToRowFromAggregate
protected void writeToRowFromAggregate(AbstractRecord record, Object object, Object attributeValue, AbstractSession session, DatabaseMapping.WriteType writeType) throws DescriptorException INTERNAL: Write the aggregate values into the parent row.- Throws:
DescriptorException
-
writeToRowFromAggregateForShallowInsert
protected void writeToRowFromAggregateForShallowInsert(AbstractRecord record, Object object, Object attributeValue, AbstractSession session) throws DescriptorException INTERNAL: Write the aggregate values into the parent row for shallow insert.- Throws:
DescriptorException
-
writeToRowFromAggregateForUpdateAfterShallowInsert
protected void writeToRowFromAggregateForUpdateAfterShallowInsert(AbstractRecord record, Object object, Object attributeValue, AbstractSession session, DatabaseTable table) throws DescriptorException INTERNAL: Write the aggregate values into the parent row for update after shallow insert.- Throws:
DescriptorException
-
writeToRowFromAggregateForUpdateBeforeShallowDelete
protected void writeToRowFromAggregateForUpdateBeforeShallowDelete(AbstractRecord record, Object object, Object attributeValue, AbstractSession session, DatabaseTable table) throws DescriptorException INTERNAL: Write the aggregate values into the parent row for update before shallow delete.- Throws:
DescriptorException
-
writeToRowFromAggregateWithChangeRecord
protected void writeToRowFromAggregateWithChangeRecord(AbstractRecord record, ChangeRecord changeRecord, ObjectChangeSet objectChangeSet, AbstractSession session, DatabaseMapping.WriteType writeType) throws DescriptorException INTERNAL: Build and return a database row built with the values from the specified attribute value.- Throws:
DescriptorException
-
writeToRowFromAggregateForUpdate
protected void writeToRowFromAggregateForUpdate(AbstractRecord record, WriteObjectQuery query, Object attributeValue) throws DescriptorException INTERNAL: Build and return a database row built with the changed values from the specified attribute value.- Throws:
DescriptorException
-
buildClone
public 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.- Overrides:
buildClone
in classAggregateMapping
- Parameters:
original
- TODOcacheKey
- TODOclone
- TODOrefreshCascade
- TODOcloningSession
- TODO
-
buildElementClone
public Object buildElementClone(Object attributeValue, Object parent, CacheKey parentCacheKey, Integer refreshCascade, AbstractSession cloningSession, boolean isExisting, boolean isFromSharedCache) INTERNAL: Build a clone of the given element in a unitOfWork- Specified by:
buildElementClone
in interfaceMapKeyMapping
-
setChangeListener
INTERNAL: Set the change listener in the aggregate.- Overrides:
setChangeListener
in classDatabaseMapping
-
buildCloneFromRow
public 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.
- Overrides:
buildCloneFromRow
in classAggregateMapping
- Parameters:
databaseRow
- TODOjoinManager
- TODOclone
- TODOsharedCacheKey
- TODOsourceQuery
- TODOunitOfWork
- TODOexecutionSession
- TODO
-
buildShallowOriginalFromRow
public void buildShallowOriginalFromRow(AbstractRecord databaseRow, Object original, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, 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).- Overrides:
buildShallowOriginalFromRow
in classDatabaseMapping
- Parameters:
databaseRow
- TODOoriginal
- TODOjoinManager
- TODOsourceQuery
- TODOexecutionSession
- TODO
-
buildSelectionQueryForDirectCollectionKeyMapping
INTERNAL: Certain key mappings favor different types of selection query. Return the appropriate type of selectionQuery- Specified by:
buildSelectionQueryForDirectCollectionKeyMapping
in interfaceMapKeyMapping
-
buildTemplateInsertRow
INTERNAL: Build and return a "template" database row with all the fields set to null. -
cascadeDiscoverAndPersistUnregisteredNewObjects
public void cascadeDiscoverAndPersistUnregisteredNewObjects(Object object, Map newObjects, Map unregisteredExistingObjects, Map visitedObjects, UnitOfWorkImpl uow, boolean getAttributeValueFromObject, Set cascadeErrors) INTERNAL: Cascade discover and persist new objects during commit to the map key- Specified by:
cascadeDiscoverAndPersistUnregisteredNewObjects
in interfaceMapKeyMapping
-
cascadePerformRemoveIfRequired
public void cascadePerformRemoveIfRequired(Object object, UnitOfWorkImpl uow, Map visitedObjects, boolean getAttributeValueFromObject) INTERNAL: Cascade perform delete through mappings that require the cascade- Specified by:
cascadePerformRemoveIfRequired
in interfaceMapKeyMapping
-
cascadePerformRemoveIfRequired
INTERNAL: Cascade perform delete through mappings that require the cascade- Specified by:
cascadePerformRemoveIfRequired
in classDatabaseMapping
- Parameters:
object
- TODOuow
- TODOvisitedObjects
- TODO
-
cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired
public void cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired(Object object, UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade perform removal of orphaned private owned objects from the UnitOfWorkChangeSet- Overrides:
cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired
in classDatabaseMapping
- Parameters:
object
- TODOuow
- TODOvisitedObjects
- TODO
-
cascadeRegisterNewIfRequired
public void cascadeRegisterNewIfRequired(Object object, UnitOfWorkImpl uow, Map visitedObjects, boolean getAttributeValueFromObject) INTERNAL: Cascade registerNew for Create through mappings that require the cascade- Specified by:
cascadeRegisterNewIfRequired
in interfaceMapKeyMapping
-
cascadeRegisterNewIfRequired
INTERNAL: Cascade registerNew for Create through mappings that require the cascade- Specified by:
cascadeRegisterNewIfRequired
in classDatabaseMapping
- Parameters:
object
- TODOuow
- TODOvisitedObjects
- TODO
-
clone
INTERNAL: Clone the aggregate to source field names. AggregateCollectionMapping needs each nested embedded mapping to have its own list of aggregate to source field names so that it can apply nested override names to shared aggregate object mappings.- Specified by:
clone
in interfaceMapComponentMapping
- Overrides:
clone
in classDatabaseMapping
- Returns:
- new instance of itself
-
collectFields
INTERNAL: Return the fields handled by the mapping.- Overrides:
collectFields
in classDatabaseMapping
- Returns:
- TODO
-
getOrderByNormalizedExpressions
INTERNAL: Aggregate order by all their fields by default.- Overrides:
getOrderByNormalizedExpressions
in classDatabaseMapping
-
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- Overrides:
collectQueryParameters
in classDatabaseMapping
- Parameters:
record
- TODO
-
convertClassNamesToClasses
INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings. This method is used when converting a project that has been built with class names to a project with classes.- Overrides:
convertClassNamesToClasses
in classAggregateMapping
- Parameters:
classLoader
- TODO
-
createMapComponentFromRow
public Object createMapComponentFromRow(AbstractRecord dbRow, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected) INTERNAL Called when a DatabaseMapping is used to map the key in a collection. Returns the key.- Specified by:
createMapComponentFromRow
in interfaceMapComponentMapping
-
createSerializableMapKeyInfo
INTERNAL: Creates the Array of simple types used to recreate this map.- Specified by:
createSerializableMapKeyInfo
in interfaceMapKeyMapping
-
createMapComponentsFromSerializableKeyInfo
public List<Object> createMapComponentsFromSerializableKeyInfo(Object[] keyInfo, AbstractSession session) INTERNAL: Create an instance of the Key object from the key information extracted from the map. This may return the value directly in case of a simple key or will be used as the FK to load a related entity.- Specified by:
createMapComponentsFromSerializableKeyInfo
in interfaceMapKeyMapping
-
createStubbedMapComponentFromSerializableKeyInfo
public Object createStubbedMapComponentFromSerializableKeyInfo(Object keyInfo, AbstractSession session) INTERNAL: Create an instance of the Key object from the key information extracted from the map. This key object may be a shallow stub of the actual object if the key is an Entity type.- Specified by:
createStubbedMapComponentFromSerializableKeyInfo
in interfaceMapKeyMapping
-
createMapComponentFromJoinedRow
public Object createMapComponentFromJoinedRow(AbstractRecord dbRow, JoinedAttributeManager joinManger, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected) INTERNAL Called when a DatabaseMapping is used to map the key in a collection and a join query is executed. Returns the key.- Specified by:
createMapComponentFromJoinedRow
in interfaceMapKeyMapping
-
createQueryKeyForMapKey
INTERNAL: Create a query key that links to the map key- Specified by:
createQueryKeyForMapKey
in interfaceMapKeyMapping
-
deleteMapKey
INTERNAL: For mappings used as MapKeys in MappedKeyContainerPolicy, Delete the passed object if necessary. This method is used for removal of private owned relationships. AggregateObjectMappings are dealt with in their parent delete, so this is a no-op.- Specified by:
deleteMapKey
in interfaceMapKeyMapping
-
dontAllowNull
public void dontAllowNull()PUBLIC: If all the fields in the database row for the aggregate object are NULL, then, by default, the mapping will place a null in the appropriate source object (as opposed to an aggregate object filled with nulls). This behavior can be explicitly set by calling #allowNull(). To change this behavior, call #dontAllowNull(). Then the mapping will build a new instance of the aggregate object that is filled with nulls and place it in the source object. In either situation, when writing, the mapping will place a NULL in all the fields in the database row for the aggregate object. Note: Any aggregate that has a relationship mapping automatically does not allow null. -
earlyPreDelete
INTERNAL: This method is called to update collection tables prior to commit.- Overrides:
earlyPreDelete
in classDatabaseMapping
- Parameters:
query
- TODOobject
- TODO
-
extractIdentityFieldsForQuery
INTERNAL: Extract the fields for the Map key from the object to use in a query.- Specified by:
extractIdentityFieldsForQuery
in interfaceMapKeyMapping
-
getAdditionalTablesForJoinQuery
INTERNAL: Return any tables that will be required when this mapping is used as part of a join query- Specified by:
getAdditionalTablesForJoinQuery
in interfaceMapKeyMapping
-
getAdditionalSelectionCriteriaForMapKey
INTERNAL: Return the selection criteria necessary to select the target object when this mapping is a map key. AggregateObjectMappings do not need any additional selection criteria when they are map keys- Specified by:
getAdditionalSelectionCriteriaForMapKey
in interfaceMapKeyMapping
-
getAggregateToSourceFieldAssociations
INTERNAL: Return a collection of the aggregate to source field associations. -
getAggregateToSourceFields
INTERNAL: Return the hashtable that stores aggregate field name to source fields. -
getNestedFieldTranslations
INTERNAL: Return the hashtable that stores the nested field translations. -
getAttributeClassification
PUBLIC: The classification type for the attribute this mapping represents- Overrides:
getAttributeClassification
in classDatabaseMapping
- 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.- Overrides:
getFieldClassification
in classDatabaseMapping
-
getIdentityFieldsForMapKey
INTERNAL: Return the fields that make up the identity of the mapped object. For mappings with a primary key, it will be the set of fields in the primary key. For mappings without a primary key it will likely be all the fields- Specified by:
getIdentityFieldsForMapKey
in interfaceMapKeyMapping
-
getAllFieldsForMapKey
INTERNAL: Get all the fields for the map key- Specified by:
getAllFieldsForMapKey
in interfaceMapKeyMapping
-
getForeignKeyFieldsForMapKey
INTERNAL: Return a Map of any foreign keys defined within the the MapKey- Specified by:
getForeignKeyFieldsForMapKey
in interfaceMapKeyMapping
-
getMatchingAttributeValueFromObject
protected Object getMatchingAttributeValueFromObject(AbstractRecord row, Object targetObject, AbstractSession session, ClassDescriptor descriptor) INTERNAL: This is used to preserve object identity during a refreshObject() query. Return the object corresponding to the specified database row. The default is to simply return the attribute value. -
getMatchingBackupAttributeValue
INTERNAL: This is used to match up objects during an update in a UOW. Return the object corresponding to the specified attribute value. The default is to simply return the backup attribute value. -
getNestedJoinQuery
public ObjectLevelReadQuery getNestedJoinQuery(JoinedAttributeManager joinManager, ObjectLevelReadQuery query, AbstractSession session) INTERNAL: Return the query that is used when this mapping is part of a joined relationship This method is used when this mapping is used to map the key in a Map- Specified by:
getNestedJoinQuery
in interfaceMapKeyMapping
-
getReferenceDescriptor
INTERNAL: Since aggregate object mappings clone their descriptors, for inheritance the correct child clone must be found.- Overrides:
getReferenceDescriptor
in classAggregateMapping
-
getReferenceFields
INTERNAL: Return the fields used to build the aggregate object. -
getTargetVersionOfSourceObject
public Object getTargetVersionOfSourceObject(Object object, Object parent, MergeManager mergeManager, AbstractSession targetSession) INTERNAL: If required, get the targetVersion of the source object from the merge manager. Used with MapKeyContainerPolicy to abstract getting the target version of a source key- Specified by:
getTargetVersionOfSourceObject
in interfaceMapKeyMapping
-
getMapKeyTargetType
INTERNAL: Return the class this key mapping maps or the descriptor for it- Specified by:
getMapKeyTargetType
in interfaceMapKeyMapping
-
hasDependency
public boolean hasDependency()INTERNAL: Return if the mapping has any ownership or other dependency over its target object(s).- Overrides:
hasDependency
in classDatabaseMapping
-
initialize
INTERNAL: For an aggregate mapping the reference descriptor is cloned. The cloned descriptor is then assigned primary keys and table names before initialize. Once the cloned descriptor is initialized it is assigned as reference descriptor in the aggregate mapping. This is a very specific behavior for aggregate mappings. The original descriptor is used only for creating clones and after that the aggregate mapping never uses it. Some initialization is done in postInitialize to ensure the target descriptor's references are initialized.- Overrides:
initialize
in classAggregateMapping
- Throws:
DescriptorException
-
initializeChildInheritance
public void initializeChildInheritance(ClassDescriptor parentDescriptor, AbstractSession session) throws DescriptorException INTERNAL: For an aggregate mapping the reference descriptor is cloned. If the reference descriptor is involved in an inheritance tree, all the parent and child descriptors are cloned also. The cloned descriptors are then assigned primary keys and table names before initialize. This is a very specific behavior for aggregate mappings.- Throws:
DescriptorException
-
initializeParentInheritance
public void initializeParentInheritance(ClassDescriptor parentDescriptor, ClassDescriptor childDescriptor, AbstractSession session) throws DescriptorException INTERNAL: For an aggregate mapping the reference descriptor is cloned. If the reference descriptor is involved in an inheritance tree, all the parent and child descriptors are cloned also. The cloned descriptors are then assigned primary keys and table names before initialize. This is a very specific behavior for aggregate mappings.- Throws:
DescriptorException
-
initializeReferenceDescriptor
protected void initializeReferenceDescriptor(ClassDescriptor clonedDescriptor, AbstractSession session) INTERNAL: Initialize the cloned reference descriptor with table names and primary keys -
iterateOnMapKey
INTERNAL: Called when iterating through descriptors to handle iteration on this mapping when it is used as a MapKey- Specified by:
iterateOnMapKey
in interfaceMapKeyMapping
-
isLockableMapping
public boolean isLockableMapping()INTERNAL: Return whether this mapping should be traversed when we are locking- Overrides:
isLockableMapping
in classDatabaseMapping
-
isAggregateObjectMapping
public boolean isAggregateObjectMapping()INTERNAL: Related mapping should implement this method to return true.- Overrides:
isAggregateObjectMapping
in classDatabaseMapping
-
isChangeTrackingSupported
INTERNAL: Return if this mapping supports change tracking.- Overrides:
isChangeTrackingSupported
in classDatabaseMapping
-
isCascadedLockingSupported
public boolean isCascadedLockingSupported()INTERNAL Return true if this mapping supports cascaded version optimistic locking.- Overrides:
isCascadedLockingSupported
in classDatabaseMapping
-
isJPAIdNested
INTERNAL: Flags that either this mapping or nested mapping is a JPA id mapping. -
isNullAllowed
public boolean isNullAllowed()PUBLIC: Return if all the fields in the database row for the aggregate object are NULL, then, by default, the mapping will place a null in the appropriate source object (as opposed to an aggregate object filled with nulls). To change this behavior, set the value of this variable to false. Then the mapping will build a new instance of the aggregate object that is filled with nulls and place it in the source object. Note: Any aggregate that has a relationship mapping automatically does not allow null. -
postInitialize
INTERNAL: For an aggregate mapping the reference descriptor is cloned. The cloned descriptor is then assigned primary keys and table names before initialize. Once the cloned descriptor is initialized it is assigned as reference descriptor in the aggregate mapping. This is a very specific behavior for aggregate mappings. The original descriptor is used only for creating clones and after that the aggregate mapping never uses it. Some initialization is done in postInitialize to ensure the target descriptor's references are initialized.- Overrides:
postInitialize
in classDatabaseMapping
- Throws:
DescriptorException
-
preinitializeMapKey
INTERNAL: Making any mapping changes necessary to use a the mapping as a map key prior to initializing the mapping- Specified by:
preinitializeMapKey
in interfaceMapKeyMapping
-
postInitializeMapKey
INTERNAL: Making any mapping changes necessary to use a the mapping as a map key after initializing the mapping.- Specified by:
postInitializeMapKey
in interfaceMapKeyMapping
-
readFromReturnRowIntoObject
public Object readFromReturnRowIntoObject(AbstractRecord row, Object targetObject, ReadObjectQuery query, Collection handledMappings, ObjectChangeSet changeSet) throws DatabaseException INTERNAL: Build an aggregate object from the specified return row and put it in the specified target object. Return row is merged into object after execution of insert or update call according to ReturningPolicy. If not null changeSet must correspond to targetObject. changeSet is updated with all of the field values in the row.- Throws:
DatabaseException
-
readFromRowIntoObject
public Object readFromRowIntoObject(AbstractRecord databaseRow, JoinedAttributeManager joinManager, Object targetObject, CacheKey parentCacheKey, ObjectBuildingQuery sourceQuery, AbstractSession executionSession, boolean isTargetProtected) throws DatabaseException INTERNAL: Build an aggregate object from the specified row and put it in the specified target object.- Overrides:
readFromRowIntoObject
in classDatabaseMapping
- Throws:
DatabaseException
-
rehashFieldDependancies
INTERNAL: Rehash any hashtables based on fields. This is used to clone descriptors for aggregates, which hammer field names.- Overrides:
rehashFieldDependancies
in classDatabaseMapping
-
requiresDataModificationEventsForMapKey
public boolean requiresDataModificationEventsForMapKey()INTERNAL: Return whether this mapping requires extra queries to update the rows if it is used as a key in a map. This will typically be true if there are any parts to this mapping that are not read-only.- Specified by:
requiresDataModificationEventsForMapKey
in interfaceMapKeyMapping
-
setAggregateToSourceFieldAssociations
INTERNAL: Set a collection of the aggregate to source field name associations. -
setAggregateToSourceFields
INTERNAL: Set the hashtable that stores target field name to the source field name. -
setNestedFieldTranslations
INTERNAL: Set the hashtable that stores a field in the source table to a field name in a nested aggregate descriptor. -
setIsNullAllowed
public void setIsNullAllowed(boolean isNullAllowed) PUBLIC: Configure if all the fields in the database row for the aggregate object are NULL, then, by default, the mapping will place a null in the appropriate source object (as opposed to an aggregate object filled with nulls). To change this behavior, set the value of this variable to false. Then the mapping will build a new instance of the aggregate object that is filled with nulls and place it in the source object. Note: Any aggregate that has a relationship mapping automatically does not allow null. -
setTableForAggregateMappingKey
INTERNAL: If this mapping is used as the key of a CollectionTableMapMapping, the table used by this mapping will be the relation table. Set this table. -
translateField
protected void translateField(DatabaseField sourceField, DatabaseField mappingField, ClassDescriptor clonedDescriptor) INTERNAL: Apply the field translation from the sourceField to the mappingField. -
translateNestedFields
INTERNAL: If field names are different in the source and aggregate objects then the translation is done here. The aggregate field name is converted to source field name from the field name mappings stored. -
translateFields
INTERNAL: If field names are different in the source and aggregate objects then the translation is done here. The aggregate field name is converted to source field name from the field name mappings stored. -
unwrapKey
INTERNAL: Allow the key mapping to unwrap the object.- Specified by:
unwrapKey
in interfaceMapKeyMapping
-
wrapKey
INTERNAL: Allow the key mapping to wrap the object.- Specified by:
wrapKey
in interfaceMapKeyMapping
-
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.- Overrides:
writeFromAttributeIntoRow
in classDatabaseMapping
-
valueFromObject
public Object valueFromObject(Object object, DatabaseField field, AbstractSession session) throws DescriptorException INTERNAL: Extract value of the field from the object- Overrides:
valueFromObject
in classDatabaseMapping
- Parameters:
object
- TODOfield
- TODOsession
- TODO- Returns:
- TODO
- Throws:
DescriptorException
-
writeFromObjectIntoRow
public void writeFromObjectIntoRow(Object object, AbstractRecord databaseRow, AbstractSession session, DatabaseMapping.WriteType writeType) throws DescriptorException INTERNAL: Get the attribute value from the object and add the appropriate values to the specified database row.- Overrides:
writeFromObjectIntoRow
in classDatabaseMapping
- Throws:
DescriptorException
-
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.- Overrides:
writeFromObjectIntoRowForShallowInsert
in classDatabaseMapping
-
writeFromObjectIntoRowForUpdateAfterShallowInsert
public void writeFromObjectIntoRowForUpdateAfterShallowInsert(Object object, AbstractRecord row, 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.- Overrides:
writeFromObjectIntoRowForUpdateAfterShallowInsert
in classDatabaseMapping
-
writeFromObjectIntoRowForUpdateBeforeShallowDelete
public void writeFromObjectIntoRowForUpdateBeforeShallowDelete(Object object, AbstractRecord row, 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.- Overrides:
writeFromObjectIntoRowForUpdateBeforeShallowDelete
in classDatabaseMapping
-
writeFromObjectIntoRowWithChangeRecord
public void writeFromObjectIntoRowWithChangeRecord(ChangeRecord changeRecord, AbstractRecord databaseRow, AbstractSession session, DatabaseMapping.WriteType writeType) throws DescriptorException INTERNAL: Get the attribute value from the object and add the appropriate values to the specified database row.- Overrides:
writeFromObjectIntoRowWithChangeRecord
in classDatabaseMapping
- Throws:
DescriptorException
-
writeFromObjectIntoRowForUpdate
public void writeFromObjectIntoRowForUpdate(WriteObjectQuery query, AbstractRecord databaseRow) throws DescriptorException INTERNAL: Get the attribute value from the object and add the changed values to the specified database row.- Overrides:
writeFromObjectIntoRowForUpdate
in classDatabaseMapping
- Throws:
DescriptorException
-
writeInsertFieldsIntoRow
INTERNAL: Write fields needed for insert into the template for with null values.- Overrides:
writeInsertFieldsIntoRow
in classDatabaseMapping
-
writeUpdateFieldsIntoRow
Description copied from class:DatabaseMapping
INTERNAL: Write fields needed for update into the template for with null values. By default inserted fields are used.- Overrides:
writeUpdateFieldsIntoRow
in classDatabaseMapping
-
addPrimaryKeyJoinField
INTERNAL: Add a primary key join column (secondary field). If this contain primary keys and the descriptor(or its subclass) has multiple tables (secondary tables or joined inheritance strategy), this should also know the primary key join columns to handle some cases properly.
-