EclipseLink1.0 - 20080707 API Reference

org.eclipse.persistence.mappings
Class AggregateObjectMapping

java.lang.Object
  extended by org.eclipse.persistence.mappings.DatabaseMapping
      extended by org.eclipse.persistence.mappings.AggregateMapping
          extended by org.eclipse.persistence.mappings.AggregateObjectMapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, RelationalMapping

public class AggregateObjectMapping
extends AggregateMapping
implements 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.

See Also:
Serialized Form
Author:
Sati
Since:
TOPLink/Java 1.0

Field Summary
protected  java.util.Map<java.lang.String,java.lang.String> aggregateToSourceFieldNames
          Map the name of a field in the aggregate descriptor to a field in the source table.
protected  boolean isNullAllowed
          If all the fields in the database row for the aggregate object are NULL, then, by default, TopLink will place a null in the appropriate source object (as opposed to an aggregate object filled with nulls).
 
Fields inherited from class org.eclipse.persistence.mappings.AggregateMapping
referenceClass, referenceClassName, referenceDescriptor
 
Fields inherited from class org.eclipse.persistence.mappings.DatabaseMapping
attributeAccessor, attributeName, descriptor, fields, isLazy, isOptional, isReadOnly, isRemotelyInitialized, NO_FIELDS, NO_WEIGHT, primaryKeyMapping, properties, weight, WEIGHT_1
 
Constructor Summary
AggregateObjectMapping()
          Default constructor.
 
Method Summary
 void addFieldNameTranslation(java.lang.String sourceFieldName, java.lang.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 addPrimaryKeyJoinField(org.eclipse.persistence.internal.helper.DatabaseField primaryKeyField, org.eclipse.persistence.internal.helper.DatabaseField secondaryField)
          INTERNAL: Add a primary key join column (secondary field).
protected  boolean allAggregateFieldsAreNull(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow)
          INTERNAL: Return whether all the aggregate fields in the specified row are NULL.
 void allowNull()
          PUBLIC: If all the fields in the database row for the aggregate object are NULL, then, by default, TopLink will place a null in the appropriate source object (as opposed to an aggregate object filled with nulls).
protected  boolean backupAttributeValueIsNull(WriteObjectQuery query)
          INTERNAL: Return whether the query's backup object has an attribute value of null.
protected  java.lang.Object buildAggregateFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, java.lang.Object targetObject, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, boolean buildShallowOriginal, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
          INTERNAL: Build and return an aggregate object from the specified row.
 void buildClone(java.lang.Object original, java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
          INTERNAL: Clone the attribute from the original and assign it to the clone.
 void buildCloneFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, java.lang.Object clone, ObjectBuildingQuery sourceQuery, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
          INTERNAL: A combination of readFromRowIntoObject and buildClone.
protected  org.eclipse.persistence.internal.sessions.AbstractRecord buildNullReferenceRow()
          INTERNAL: Build and return a database row with all the reference fields set to nulls.
 Expression buildObjectJoinExpression(Expression expression, Expression argument, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Used to allow object level comparisons.
 Expression buildObjectJoinExpression(Expression expression, java.lang.Object value, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Used to allow object level comparisons.
protected  org.eclipse.persistence.internal.sessions.AbstractRecord buildRowFromAggregate(java.lang.Object object, java.lang.Object attributeValue, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Build and return a database row built with the values from the specified attribute value.
protected  org.eclipse.persistence.internal.sessions.AbstractRecord buildRowFromAggregate(java.lang.Object object, java.lang.Object attributeValue, org.eclipse.persistence.internal.sessions.AbstractSession session, boolean forceWriteOfReadOnlyClasses)
          INTERNAL: Build and return a database row built with the values from the specified attribute value.
protected  org.eclipse.persistence.internal.sessions.AbstractRecord buildRowFromAggregateForUpdate(WriteObjectQuery query, java.lang.Object attributeValue)
          INTERNAL: Build and return a database row built with the changed values from the specified attribute value.
protected  org.eclipse.persistence.internal.sessions.AbstractRecord buildRowFromAggregateWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Build and return a database row built with the values from the specified attribute value.
protected  org.eclipse.persistence.internal.sessions.AbstractRecord buildRowFromAggregateWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet, org.eclipse.persistence.internal.sessions.AbstractSession session, boolean forceWriteOfReadOnlyClasses)
          INTERNAL: Build and return a database row built with the values from the specified attribute value.
 void buildShallowOriginalFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, java.lang.Object original, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
          INTERNAL: Builds a shallow original object.
protected  org.eclipse.persistence.internal.sessions.AbstractRecord buildTemplateInsertRow(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Build and return a "template" database row with all the fields set to null.
 void cascadePerformRemoveIfRequired(java.lang.Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, java.util.Map visitedObjects)
          INTERNAL: Cascade perform delete through mappings that require the cascade
 void cascadeRegisterNewIfRequired(java.lang.Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, java.util.Map visitedObjects)
          INTERNAL: Cascade registerNew for Create through mappings that require the cascade
protected  java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> collectFields()
          INTERNAL: Return the fields handled by the mapping.
 void dontAllowNull()
          PUBLIC: If all the fields in the database row for the aggregate object are NULL, then, by default, TopLink will place a null in the appropriate source object (as opposed to an aggregate object filled with nulls).
 java.util.Vector<Association> getAggregateToSourceFieldNameAssociations()
          INTERNAL: Return a collection of the aggregate to source field name associations.
 java.util.Map<java.lang.String,java.lang.String> getAggregateToSourceFieldNames()
          INTERNAL: Return the hashtable that stores aggregate field name to source field name.
 java.lang.Class getFieldClassification(org.eclipse.persistence.internal.helper.DatabaseField fieldToClassify)
          INTERNAL: Return the classification for the field contained in the mapping.
protected  java.lang.Object getMatchingAttributeValueFromObject(org.eclipse.persistence.internal.sessions.AbstractRecord row, java.lang.Object targetObject, org.eclipse.persistence.internal.sessions.AbstractSession session, ClassDescriptor descriptor)
          INTERNAL: This is used to preserve object identity during a refreshObject() query.
protected  java.lang.Object getMatchingBackupAttributeValue(WriteObjectQuery query, java.lang.Object attributeValue)
          INTERNAL: This is used to match up objects during an update in a UOW.
protected  ClassDescriptor getReferenceDescriptor(java.lang.Class theClass, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Since aggregate object mappings clone their descriptors, for inheritance the correct child clone must be found.
protected  java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> getReferenceFields()
          INTERNAL: Return the fields used to build the aggregate object.
 boolean hasDependency()
          INTERNAL: Return if the mapping has any ownership or other dependency over its target object(s).
 void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: For an aggregate mapping the reference descriptor is cloned.
 void initializeChildInheritance(ClassDescriptor parentDescriptor, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: For an aggregate mapping the reference descriptor is cloned.
 void initializeParentInheritance(ClassDescriptor parentDescriptor, ClassDescriptor childDescriptor, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: For an aggregate mapping the reference descriptor is cloned.
protected  void initializeReferenceDescriptor(ClassDescriptor clonedDescriptor)
          INTERNAL: Initialize the cloned reference descriptor with table names and primary keys
 boolean isAggregateObjectMapping()
          INTERNAL: Related mapping should implement this method to return true.
 boolean isCascadedLockingSupported()
          INTERNAL Return true if this mapping supports cascaded version optimistic locking.
 boolean isChangeTrackingSupported(Project project)
          INTERNAL: Return if this mapping supports change tracking.
 boolean isNullAllowed()
          INTERNAL: Return setting.
 boolean isRelationalMapping()
          INTERNAL:
 void postInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: For an aggregate mapping the reference descriptor is cloned.
 java.lang.Object readFromReturnRowIntoObject(org.eclipse.persistence.internal.sessions.AbstractRecord row, java.lang.Object targetObject, ReadObjectQuery query, java.util.Collection handledMappings)
          INTERNAL: Build an aggregate object from the specified return row and put it in the specified target object.
 java.lang.Object readFromRowIntoObject(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, java.lang.Object targetObject, ObjectBuildingQuery sourceQuery, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
          INTERNAL: Build an aggregate object from the specified row and put it in the specified target object.
 void rehashFieldDependancies(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Rehash any hashtables based on fields.
 void setAggregateToSourceFieldNameAssociations(java.util.Vector<Association> fieldAssociations)
          INTERNAL: Set a collection of the aggregate to source field name associations.
protected  void setAggregateToSourceFieldNames(java.util.Map<java.lang.String,java.lang.String> aggregateToSource)
          INTERNAL: Set the hashtable that stores target field name to the source field name.
 void setChangeListener(java.lang.Object clone, java.beans.PropertyChangeListener listener, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
          INTERNAL: Set the change listener in the aggregate.
 void setIsNullAllowed(boolean aBoolean)
          INTERNAL: Will be used by Gromit only.
protected  void translateFields(ClassDescriptor clonedDescriptor, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: If field names are different in the source and aggregate objects then the translation is done here.
 java.lang.Object valueFromObject(java.lang.Object object, org.eclipse.persistence.internal.helper.DatabaseField field, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Extract value of the field from the object
 void writeFromAttributeIntoRow(java.lang.Object attribute, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: A subclass should implement this method if it wants different behavior.
 void writeFromObjectIntoRow(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Get the attribute value from the object and add the appropriate values to the specified database row.
 void writeFromObjectIntoRowForUpdate(WriteObjectQuery query, org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow)
          INTERNAL: Get the attribute value from the object and add the changed values to the specified database row.
 void writeFromObjectIntoRowWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Get the attribute value from the object and add the appropriate values to the specified database row.
 void writeInsertFieldsIntoRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Write fields needed for insert into the template for with null values.
 
Methods inherited from class org.eclipse.persistence.mappings.AggregateMapping
buildAggregateDeleteQuery, buildAggregateModifyQuery, buildAggregateWriteQuery, buildBackupClone, buildBackupClonePart, buildClonePart, buildCopy, buildCopyOfAttributeValue, buildExpression, buildNewMergeInstanceOf, compareAttributeValues, compareForChange, compareObjects, convertClassNamesToClasses, executeEvent, fixAttributeValue, fixObjectReferences, getAttributeValueFromBackupClone, getObjectBuilder, getObjectBuilderForClass, getQueryManager, getReferenceClass, getReferenceClassName, getReferenceDescriptor, getReferenceDescriptor, isAggregateMapping, iterate, iterateOnAttributeValue, 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
addToCollectionChangeRecord, buildBackupCloneForPartObject, buildChangeRecord, buildCloneForPartObject, calculateDeferredChanges, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadeMerge, clone, cloneFields, createUnitOfWorkValueHolder, extractNestedExpressions, fixRealObjectReferences, getAttributeAccessor, getAttributeClassification, getAttributeName, getAttributeValueFromObject, getContainerPolicy, getDescriptor, getField, getFields, getGetMethodName, getObjectCorrespondingTo, getProperties, getProperty, getRealAttributeValueFromObject, getRealCollectionAttributeValueFromObject, getRelationshipPartner, getSelectFields, getSelectTables, getSetMethodName, getValueFromRemoteValueHolder, getWeight, hasConstraintDependency, hasInverseConstraintDependency, hasRootExpressionThatShouldUseOuterJoin, instantiateAttribute, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isCloningRequired, isCollectionMapping, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isForeignReferenceMapping, isJoiningSupported, isLazy, isManyToManyMapping, isNestedTableMapping, isObjectReferenceMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isPrimaryKeyMapping, isPrivateOwned, isReadOnly, isReferenceMapping, isRemotelyInitialized, isStructureMapping, isTransformationMapping, isUsingMethodAccess, isVariableOneToOneMapping, isWriteOnly, isXMLMapping, iterateOnRealAttributeValue, performDataModificationEvent, preInitialize, prepareCascadeLockingPolicy, readFromResultSetIntoObject, readFromRowIntoObject, readOnly, readWrite, remotelyInitialized, removeFromCollectionChangeRecord, replaceValueHoldersIn, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setDescriptor, setFields, setGetMethodName, setIsLazy, setIsOptional, setIsPrimaryKeyMapping, setIsReadOnly, setProperties, setProperty, setRealAttributeValueInObject, setSetMethodName, setWeight, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, toString, validateAfterInitialization, validateBeforeInitialization, valueFromResultSet, valueFromRow, valueFromRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForWhereClause, writeUpdateFieldsIntoRow
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isNullAllowed

protected boolean isNullAllowed
If all the fields in the database row for the aggregate object are NULL, then, by default, TopLink 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 TopLink will build a new instance of the aggregate object that is filled with nulls and place it in the source object.


aggregateToSourceFieldNames

protected transient java.util.Map<java.lang.String,java.lang.String> aggregateToSourceFieldNames
Map the name of a field in the aggregate descriptor to a field in the source table.

Constructor Detail

AggregateObjectMapping

public AggregateObjectMapping()
Default constructor.

Method Detail

isRelationalMapping

public boolean isRelationalMapping()
INTERNAL:

Overrides:
isRelationalMapping in class DatabaseMapping

addFieldNameTranslation

public void addFieldNameTranslation(java.lang.String sourceFieldName,
                                    java.lang.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.


allAggregateFieldsAreNull

protected boolean allAggregateFieldsAreNull(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow)
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, TopLink 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 TopLink 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, TopLink will place a NULL in all the fields in the database row for the aggregate object.


backupAttributeValueIsNull

protected boolean backupAttributeValueIsNull(WriteObjectQuery query)
INTERNAL: Return whether the query's backup object has an attribute value of null.


buildAggregateFromRow

protected java.lang.Object buildAggregateFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                                 java.lang.Object targetObject,
                                                 org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                                 ObjectBuildingQuery sourceQuery,
                                                 boolean buildShallowOriginal,
                                                 org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
                                          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

buildNullReferenceRow

protected org.eclipse.persistence.internal.sessions.AbstractRecord buildNullReferenceRow()
INTERNAL: Build and return a database row with all the reference fields set to nulls.


buildObjectJoinExpression

public Expression buildObjectJoinExpression(Expression expression,
                                            java.lang.Object value,
                                            org.eclipse.persistence.internal.sessions.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 class DatabaseMapping

buildObjectJoinExpression

public Expression buildObjectJoinExpression(Expression expression,
                                            Expression argument,
                                            org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Used to allow object level comparisons.

Overrides:
buildObjectJoinExpression in class DatabaseMapping

buildRowFromAggregate

protected org.eclipse.persistence.internal.sessions.AbstractRecord buildRowFromAggregate(java.lang.Object object,
                                                                                         java.lang.Object attributeValue,
                                                                                         org.eclipse.persistence.internal.sessions.AbstractSession session)
                                                                                  throws DescriptorException
INTERNAL: Build and return a database row built with the values from the specified attribute value.

Throws:
DescriptorException

buildRowFromAggregate

protected org.eclipse.persistence.internal.sessions.AbstractRecord buildRowFromAggregate(java.lang.Object object,
                                                                                         java.lang.Object attributeValue,
                                                                                         org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                                                         boolean forceWriteOfReadOnlyClasses)
                                                                                  throws DescriptorException
INTERNAL: Build and return a database row built with the values from the specified attribute value.

Throws:
DescriptorException

buildRowFromAggregateWithChangeRecord

protected org.eclipse.persistence.internal.sessions.AbstractRecord buildRowFromAggregateWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord,
                                                                                                         org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet,
                                                                                                         org.eclipse.persistence.internal.sessions.AbstractSession session)
                                                                                                  throws DescriptorException
INTERNAL: Build and return a database row built with the values from the specified attribute value.

Throws:
DescriptorException

buildRowFromAggregateWithChangeRecord

protected org.eclipse.persistence.internal.sessions.AbstractRecord buildRowFromAggregateWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord,
                                                                                                         org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet,
                                                                                                         org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                                                                         boolean forceWriteOfReadOnlyClasses)
                                                                                                  throws DescriptorException
INTERNAL: Build and return a database row built with the values from the specified attribute value.

Throws:
DescriptorException

buildRowFromAggregateForUpdate

protected org.eclipse.persistence.internal.sessions.AbstractRecord buildRowFromAggregateForUpdate(WriteObjectQuery query,
                                                                                                  java.lang.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(java.lang.Object original,
                       java.lang.Object clone,
                       org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
INTERNAL: Clone the attribute from the original and assign it to the clone.

Overrides:
buildClone in class AggregateMapping

setChangeListener

public void setChangeListener(java.lang.Object clone,
                              java.beans.PropertyChangeListener listener,
                              org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
INTERNAL: Set the change listener in the aggregate.

Overrides:
setChangeListener in class DatabaseMapping

buildCloneFromRow

public void buildCloneFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                              org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                              java.lang.Object clone,
                              ObjectBuildingQuery sourceQuery,
                              org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork,
                              org.eclipse.persistence.internal.sessions.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 class AggregateMapping

buildShallowOriginalFromRow

public void buildShallowOriginalFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                        java.lang.Object original,
                                        org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                        ObjectBuildingQuery sourceQuery,
                                        org.eclipse.persistence.internal.sessions.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 class DatabaseMapping

buildTemplateInsertRow

protected org.eclipse.persistence.internal.sessions.AbstractRecord buildTemplateInsertRow(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Build and return a "template" database row with all the fields set to null.


cascadePerformRemoveIfRequired

public void cascadePerformRemoveIfRequired(java.lang.Object object,
                                           org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
                                           java.util.Map visitedObjects)
INTERNAL: Cascade perform delete through mappings that require the cascade

Specified by:
cascadePerformRemoveIfRequired in class DatabaseMapping

cascadeRegisterNewIfRequired

public void cascadeRegisterNewIfRequired(java.lang.Object object,
                                         org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
                                         java.util.Map visitedObjects)
INTERNAL: Cascade registerNew for Create through mappings that require the cascade

Specified by:
cascadeRegisterNewIfRequired in class DatabaseMapping

collectFields

protected java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> collectFields()
INTERNAL: Return the fields handled by the mapping.

Overrides:
collectFields in class DatabaseMapping

dontAllowNull

public void dontAllowNull()
PUBLIC: If all the fields in the database row for the aggregate object are NULL, then, by default, TopLink 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 TopLink 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, TopLink will place a NULL in all the fields in the database row for the aggregate object.


getAggregateToSourceFieldNameAssociations

public java.util.Vector<Association> getAggregateToSourceFieldNameAssociations()
INTERNAL: Return a collection of the aggregate to source field name associations.


getAggregateToSourceFieldNames

public java.util.Map<java.lang.String,java.lang.String> getAggregateToSourceFieldNames()
INTERNAL: Return the hashtable that stores aggregate field name to source field name.


getFieldClassification

public java.lang.Class getFieldClassification(org.eclipse.persistence.internal.helper.DatabaseField fieldToClassify)
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 class DatabaseMapping

getMatchingAttributeValueFromObject

protected java.lang.Object getMatchingAttributeValueFromObject(org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                                               java.lang.Object targetObject,
                                                               org.eclipse.persistence.internal.sessions.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

protected java.lang.Object getMatchingBackupAttributeValue(WriteObjectQuery query,
                                                           java.lang.Object attributeValue)
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.


getReferenceDescriptor

protected ClassDescriptor getReferenceDescriptor(java.lang.Class theClass,
                                                 org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Since aggregate object mappings clone their descriptors, for inheritance the correct child clone must be found.

Overrides:
getReferenceDescriptor in class AggregateMapping

getReferenceFields

protected java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> getReferenceFields()
INTERNAL: Return the fields used to build the aggregate object.


hasDependency

public boolean hasDependency()
INTERNAL: Return if the mapping has any ownership or other dependency over its target object(s).

Overrides:
hasDependency in class DatabaseMapping

initialize

public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
                throws DescriptorException
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 class AggregateMapping
Throws:
DescriptorException

initializeChildInheritance

public void initializeChildInheritance(ClassDescriptor parentDescriptor,
                                       org.eclipse.persistence.internal.sessions.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,
                                        org.eclipse.persistence.internal.sessions.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)
INTERNAL: Initialize the cloned reference descriptor with table names and primary keys


isAggregateObjectMapping

public boolean isAggregateObjectMapping()
INTERNAL: Related mapping should implement this method to return true.

Overrides:
isAggregateObjectMapping in class DatabaseMapping

isChangeTrackingSupported

public boolean isChangeTrackingSupported(Project project)
INTERNAL: Return if this mapping supports change tracking.

Overrides:
isChangeTrackingSupported in class DatabaseMapping

isCascadedLockingSupported

public boolean isCascadedLockingSupported()
INTERNAL Return true if this mapping supports cascaded version optimistic locking.

Overrides:
isCascadedLockingSupported in class DatabaseMapping

isNullAllowed

public boolean isNullAllowed()
INTERNAL: Return setting.


postInitialize

public void postInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
                    throws DescriptorException
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 class DatabaseMapping
Throws:
DescriptorException

readFromReturnRowIntoObject

public java.lang.Object readFromReturnRowIntoObject(org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                                    java.lang.Object targetObject,
                                                    ReadObjectQuery query,
                                                    java.util.Collection handledMappings)
                                             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 accordiing to ReturningPolicy.

Throws:
DatabaseException

readFromRowIntoObject

public java.lang.Object readFromRowIntoObject(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                              org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                              java.lang.Object targetObject,
                                              ObjectBuildingQuery sourceQuery,
                                              org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
                                       throws DatabaseException
INTERNAL: Build an aggregate object from the specified row and put it in the specified target object.

Overrides:
readFromRowIntoObject in class DatabaseMapping
Throws:
DatabaseException

rehashFieldDependancies

public void rehashFieldDependancies(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Rehash any hashtables based on fields. This is used to clone descriptors for aggregates, which hammer field names.

Overrides:
rehashFieldDependancies in class DatabaseMapping

setAggregateToSourceFieldNameAssociations

public void setAggregateToSourceFieldNameAssociations(java.util.Vector<Association> fieldAssociations)
INTERNAL: Set a collection of the aggregate to source field name associations.


setAggregateToSourceFieldNames

protected void setAggregateToSourceFieldNames(java.util.Map<java.lang.String,java.lang.String> aggregateToSource)
INTERNAL: Set the hashtable that stores target field name to the source field name.


setIsNullAllowed

public void setIsNullAllowed(boolean aBoolean)
INTERNAL: Will be used by Gromit only.


translateFields

protected void translateFields(ClassDescriptor clonedDescriptor,
                               org.eclipse.persistence.internal.sessions.AbstractSession session)
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.


writeFromAttributeIntoRow

public void writeFromAttributeIntoRow(java.lang.Object attribute,
                                      org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                      org.eclipse.persistence.internal.sessions.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 class DatabaseMapping

valueFromObject

public java.lang.Object valueFromObject(java.lang.Object object,
                                        org.eclipse.persistence.internal.helper.DatabaseField field,
                                        org.eclipse.persistence.internal.sessions.AbstractSession session)
                                 throws DescriptorException
INTERNAL: Extract value of the field from the object

Overrides:
valueFromObject in class DatabaseMapping
Throws:
DescriptorException

writeFromObjectIntoRow

public void writeFromObjectIntoRow(java.lang.Object object,
                                   org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                   org.eclipse.persistence.internal.sessions.AbstractSession session)
                            throws DescriptorException
INTERNAL: Get the attribute value from the object and add the appropriate values to the specified database row.

Overrides:
writeFromObjectIntoRow in class DatabaseMapping
Throws:
DescriptorException

writeFromObjectIntoRowWithChangeRecord

public void writeFromObjectIntoRowWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord,
                                                   org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                                   org.eclipse.persistence.internal.sessions.AbstractSession session)
                                            throws DescriptorException
INTERNAL: Get the attribute value from the object and add the appropriate values to the specified database row.

Overrides:
writeFromObjectIntoRowWithChangeRecord in class DatabaseMapping
Throws:
DescriptorException

writeFromObjectIntoRowForUpdate

public void writeFromObjectIntoRowForUpdate(WriteObjectQuery query,
                                            org.eclipse.persistence.internal.sessions.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 class DatabaseMapping
Throws:
DescriptorException

writeInsertFieldsIntoRow

public void writeInsertFieldsIntoRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                     org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Write fields needed for insert into the template for with null values.

Overrides:
writeInsertFieldsIntoRow in class DatabaseMapping

addPrimaryKeyJoinField

public void addPrimaryKeyJoinField(org.eclipse.persistence.internal.helper.DatabaseField primaryKeyField,
                                   org.eclipse.persistence.internal.helper.DatabaseField secondaryField)
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.


EclipseLink1.0 - 20080707 API Reference