Oracle Application Server TopLink API Reference
10g (9.0.4.3)

B10491-02

oracle.toplink.mappings
Class AggregateCollectionMapping

java.lang.Object
  extended byoracle.toplink.mappings.DatabaseMapping
      extended byoracle.toplink.mappings.ForeignReferenceMapping
          extended byoracle.toplink.mappings.CollectionMapping
              extended byoracle.toplink.mappings.AggregateCollectionMapping

All Implemented Interfaces:
java.lang.Cloneable, ContainerMapping, java.io.Serializable

public class AggregateCollectionMapping
extends CollectionMapping

Purpose: The aggregate collection mapping is used to represent the aggregate relationship between a single source object and a collection of target objects. The target objects cannot exist without the existence of the source object (privately owned) Unlike the normal aggregate mapping, there is a target table being mapped from the target objects. Unlike normal 1:m mapping, there is no 1:1 back reference mapping, as foreign key constraints have been resolved by the aggregation.

Since:
TOPLink/Java 3.0
See Also:
Serialized Form

Constructor Summary
AggregateCollectionMapping()
          PUBLIC: Default constructor.

 

Method Summary
 void addTargetForeignKeyFieldName(java.lang.String targetForeignKey, java.lang.String sourceKey)
          PUBLIC: Define the target foreign key relationship in the 1-M aggregate collection mapping.
 java.lang.Object buildBackupCloneForPartObject(java.lang.Object attributeValue, java.lang.Object clone, java.lang.Object backup, oracle.toplink.publicinterface.UnitOfWork unitOfWork)
          INTERNAL: Used during building the backup shallow copy to copy the vector without re-registering the target objects.
 java.lang.Object buildCloneForPartObject(java.lang.Object attributeValue, java.lang.Object original, java.lang.Object clone, oracle.toplink.publicinterface.UnitOfWork unitOfWork, boolean isExisting)
          INTERNAL: Require for cloning, the part must be cloned.
 java.lang.Object clone()
          INTERNAL: The mapping clones itself to create deep copy.
 oracle.toplink.internal.sessions.ChangeRecord compareForChange(java.lang.Object clone, java.lang.Object backUp, oracle.toplink.internal.sessions.ObjectChangeSet owner, oracle.toplink.publicinterface.Session session)
          INTERNAL: This method is used to create a change record from comparing two aggregate collections
 boolean compareObjects(java.lang.Object firstObject, java.lang.Object secondObject, oracle.toplink.publicinterface.Session session)
          INTERNAL: Compare the attributes belonging to this mapping for the objects.
 java.lang.Object extractResultFromBatchQuery(DatabaseQuery query, DatabaseRow databaseRow, oracle.toplink.publicinterface.Session session, DatabaseRow argumentRow)
          INTERNAL: Extract the value from the batch optmized query.
 DatabaseRow getAggregateRow(ObjectLevelModifyQuery query, java.lang.Object object)
          INTERNAL: return the aggregate databaseRow with the primary keys from the source table and targer table
 Descriptor getReferenceDescriptor(java.lang.Class theClass, oracle.toplink.publicinterface.Session session)
          INTERNAL: for inheritance purpose
 java.util.Vector getReferenceObjectKeys(ObjectLevelModifyQuery query)
          INTERNAL: get reference object keys
 java.util.Vector getSourceKeyFieldNames()
          PUBLIC: Return the source key field names associated with the mapping.
 java.util.Vector getSourceKeyFields()
          INTERNAL: Return the source key names associated with the mapping
 java.util.Vector getTargetForeignKeyFieldNames()
          PUBLIC: Return the target foregin key field names associated with the mapping.
 java.util.Vector getTargetForeignKeyFields()
          INTERNAL: Return the target foregin key fields associated with the mapping
 java.util.Hashtable getTargetForeignKeyToSourceKeys()
          INTERNAL:
 void initialize(oracle.toplink.publicinterface.Session session)
          INTERNAL: For aggregate collection mapping the reference descriptor is cloned.
 void initializeChildInheritance(Descriptor parentDescriptor, oracle.toplink.publicinterface.Session session)
          INTERNAL: For aggregate mapping the reference descriptor is cloned.
 void initializeParentInheritance(Descriptor parentDescriptor, Descriptor childDescriptor, oracle.toplink.publicinterface.Session session)
          INTERNAL: For aggregate mapping the reference descriptor is cloned.
 boolean isAggregateCollectionMapping()
          INTERNAL:
 boolean isPrivateOwned()
          INTERNAL:
 void mergeChangesIntoObject(java.lang.Object target, oracle.toplink.internal.sessions.ChangeRecord changeRecord, java.lang.Object source, oracle.toplink.internal.sessions.MergeManager mergeManager)
          INTERNAL: Merge changes from the source to the target object.
 void mergeIntoObject(java.lang.Object target, boolean isTargetUnInitialized, java.lang.Object source, oracle.toplink.internal.sessions.MergeManager mergeManager)
          INTERNAL: Merge changes from the source to the target object.
 void postInitialize(oracle.toplink.publicinterface.Session session)
          INTERNAL: For aggregate collection mapping the reference descriptor is cloned.
 void postInsert(WriteObjectQuery query)
          INTERNAL: Insert privately owned parts
 void postUpdate(WriteObjectQuery writeQuery)
          INTERNAL: Update the privately owned parts
 void preDelete(DeleteObjectQuery query)
          INTERNAL: Delete privately owned parts
 void preInsert(WriteObjectQuery query)
          INTERNAL: The message is passed to its reference class descriptor.
 void prepareModifyQuery(ObjectLevelModifyQuery originalQuery, ObjectLevelModifyQuery modifyQuery, java.lang.Object object)
          INTERNAL: setup the modifyQuery for post insert/update and pre delete
 void prepareModifyQueryForDelete(ObjectLevelModifyQuery originalQuery, ObjectLevelModifyQuery modifyQuery, java.lang.Object object)
          INTERNAL: setup the modifyQuery for pre delete
 void prepareModifyQueryForUpdate(ObjectLevelModifyQuery originalQuery, ObjectLevelModifyQuery modifyQuery, java.lang.Object object)
          INTERNAL: setup the modifyQuery for update,
 void setSourceKeyFieldNames(java.util.Vector fieldNames)
          PUBLIC: Set the source key field names associated with the mapping.
 void setTargetForeignKeyFieldNames(java.util.Vector fieldNames)
          PUBLIC: Set the target foregin key field names associated with the mapping.
 void simpleAddToCollectionChangeRecord(java.lang.Object referenceKey, java.lang.Object changeSetToAdd, oracle.toplink.internal.sessions.ObjectChangeSet changeSet, oracle.toplink.publicinterface.Session session)
          ADVANCED: This method is used to have an object add to a collection once the changeSet is applied The referenceKey parameter should only be used for direct Maps.
 void simpleRemoveFromCollectionChangeRecord(java.lang.Object referenceKey, java.lang.Object changeSetToRemove, oracle.toplink.internal.sessions.ObjectChangeSet changeSet, oracle.toplink.publicinterface.Session session)
          ADVANCED: This method is used to have an object removed from a collection once the changeSet is applied The referenceKey parameter should only be used for direct Maps.
 java.lang.Object valueFromRow(DatabaseRow row, ObjectLevelReadQuery sourceQuery)
          INTERNAL: Retrieves a value from the row for a particular query key
 boolean verifyDelete(java.lang.Object object, oracle.toplink.publicinterface.Session session)
          INTERNAL: Checks if object is deleted from the database or not.

 

Methods inherited from class oracle.toplink.mappings.CollectionMapping
addAscendingOrdering, addDescendingOrdering, buildCopy, cascadeMerge, fixRealObjectReferences, getAscendingOrderByQueryKey, getContainerPolicy, getDescendingOrderByQueryKey, getObjectCorrespondingTo, getRealAttributeValueFromObject, getRealCollectionAttributeValueFromObject, isCollectionMapping, iterateOnElement, iterateOnRealAttributeValue, replaceValueHoldersIn, setContainerPolicy, setCustomDeleteAllQuery, setDeleteAllSQLString, setSessionName, useCollectionClass, useMapClass, useSortedSetClass, useTransparentCollection, useTransparentMap, validateBeforeInitialization

 

Methods inherited from class oracle.toplink.mappings.ForeignReferenceMapping
buildBackupClone, buildClone, createUnitOfWorkValueHolder, dontUseBatchReading, dontUseIndirection, fixObjectReferences, getAttributeValueFromObject, getIndirectionPolicy, getJoinCriteria, getReferenceClass, getReferenceDescriptor, getRelationshipPartner, getRelationshipPartnerAttributeName, getSelectionCriteria, getSelectionQuery, getValueFromRemoteValueHolder, isAttributeValueInstantiated, isForeignReferenceMapping, iterate, mergeRemoteValueHolder, privateOwnedRelationship, remoteInitialization, setCustomSelectionQuery, setIndirectionPolicy, setIsPrivateOwned, setRealAttributeValueInObject, setReferenceClass, setRelationshipPartner, setRelationshipPartnerAttributeName, setSelectionCriteria, setSelectionSQLString, setUsesBatchReading, setUsesIndirection, shouldMergeCascadeParts, shouldUseBatchReading, useBasicIndirection, useBatchReading, useContainerIndirection, useIndirection, usesIndirection

 

Methods inherited from class oracle.toplink.mappings.DatabaseMapping
buildExpression, buildObjectJoinExpression, buildObjectJoinExpression, getAttributeAccessor, getAttributeClassification, getAttributeName, getDescriptor, getField, getFieldClassification, getFields, getGetMethodName, getProperties, getProperty, getSetMethodName, getWeight, hasConstraintDependency, hasDependency, hasInverseConstraintDependency, isAggregateMapping, isAggregateObjectMapping, isDatabaseMapping, isDirectCollectionMapping, isDirectToFieldMapping, isManyToManyMapping, isNestedTableMapping, isObjectReferenceMapping, isObjectTypeMapping, isOneToManyMapping, isOneToOneMapping, isReadOnly, isReferenceMapping, isSerializedObjectMapping, isStructureMapping, isTransformationMapping, isTypeConversionMapping, isVariableOneToOneMapping, isWriteOnly, performDataModificationEvent, postDelete, preInitialize, preUpdate, readFromRowIntoObject, readOnly, readWrite, rehashFieldDependancies, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setDescriptor, setGetMethodName, setIsReadOnly, setProperties, setProperty, setSetMethodName, setWeight, toString, validateAfterInitialization, valueFromObject, writeFromObjectIntoRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdate, writeFromObjectIntoRowForWhereClause, writeFromObjectIntoRowWithChangeRecord, writeInsertFieldsIntoRow, writeUpdateFieldsIntoRow

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Constructor Detail

AggregateCollectionMapping

public AggregateCollectionMapping()
PUBLIC: Default constructor.
Method Detail

addTargetForeignKeyFieldName

public void addTargetForeignKeyFieldName(java.lang.String targetForeignKey,
                                         java.lang.String sourceKey)
PUBLIC: Define the target foreign key relationship in the 1-M aggregate collection mapping. Both the target foreign key field name and the source primary key field name must be specified.

buildBackupCloneForPartObject

public java.lang.Object buildBackupCloneForPartObject(java.lang.Object attributeValue,
                                                      java.lang.Object clone,
                                                      java.lang.Object backup,
                                                      oracle.toplink.publicinterface.UnitOfWork unitOfWork)
INTERNAL: Used during building the backup shallow copy to copy the vector without re-registering the target objects.
Overrides:
buildBackupCloneForPartObject in class CollectionMapping

buildCloneForPartObject

public java.lang.Object buildCloneForPartObject(java.lang.Object attributeValue,
                                                java.lang.Object original,
                                                java.lang.Object clone,
                                                oracle.toplink.publicinterface.UnitOfWork unitOfWork,
                                                boolean isExisting)
INTERNAL: Require for cloning, the part must be cloned. Ignore the objects, use the attribute value. this is identical to the super class except that the element must be added to the new aggregates collection so that the referenced objects will be clonned correctly
Overrides:
buildCloneForPartObject in class CollectionMapping

clone

public java.lang.Object clone()
INTERNAL: The mapping clones itself to create deep copy.
Overrides:
clone in class ForeignReferenceMapping

compareForChange

public oracle.toplink.internal.sessions.ChangeRecord compareForChange(java.lang.Object clone,
                                                                      java.lang.Object backUp,
                                                                      oracle.toplink.internal.sessions.ObjectChangeSet owner,
                                                                      oracle.toplink.publicinterface.Session session)
INTERNAL: This method is used to create a change record from comparing two aggregate collections
Overrides:
compareForChange in class CollectionMapping
Returns:
ChangeRecord

compareObjects

public boolean compareObjects(java.lang.Object firstObject,
                              java.lang.Object secondObject,
                              oracle.toplink.publicinterface.Session session)
INTERNAL: Compare the attributes belonging to this mapping for the objects.
Overrides:
compareObjects in class CollectionMapping

extractResultFromBatchQuery

public java.lang.Object extractResultFromBatchQuery(DatabaseQuery query,
DatabaseRow databaseRow,
                                                    oracle.toplink.publicinterface.Session session,
DatabaseRow argumentRow)
INTERNAL: Extract the value from the batch optmized query.
Overrides:
extractResultFromBatchQuery in class ForeignReferenceMapping

getAggregateRow

public DatabaseRow getAggregateRow(ObjectLevelModifyQuery query,
                                   java.lang.Object object)
INTERNAL: return the aggregate databaseRow with the primary keys from the source table and targer table

getReferenceDescriptor

public Descriptor getReferenceDescriptor(java.lang.Class theClass,
                                         oracle.toplink.publicinterface.Session session)
INTERNAL: for inheritance purpose

getReferenceObjectKeys

public java.util.Vector getReferenceObjectKeys(ObjectLevelModifyQuery query)
                                        throws DatabaseException,
OptimisticLockException
INTERNAL: get reference object keys
Throws:
DatabaseException
OptimisticLockException

getSourceKeyFieldNames

public java.util.Vector getSourceKeyFieldNames()
PUBLIC: Return the source key field names associated with the mapping. These are in-order with the targetForeignKeyFieldNames.

getSourceKeyFields

public java.util.Vector getSourceKeyFields()
INTERNAL: Return the source key names associated with the mapping

getTargetForeignKeyFieldNames

public java.util.Vector getTargetForeignKeyFieldNames()
PUBLIC: Return the target foregin key field names associated with the mapping. These are in-order with the sourceKeyFieldNames.

getTargetForeignKeyFields

public java.util.Vector getTargetForeignKeyFields()
INTERNAL: Return the target foregin key fields associated with the mapping

getTargetForeignKeyToSourceKeys

public java.util.Hashtable getTargetForeignKeyToSourceKeys()
INTERNAL:

initialize

public void initialize(oracle.toplink.publicinterface.Session session)
                throws DescriptorException
INTERNAL: For aggregate collection mapping the reference descriptor is cloned. The cloned descriptor is then assigned primary keys and table names before initialize. Once cloned descriptor is initialized it is assigned as reference descriptor in the aggregate mapping. This is a very specifiec behaviour for aggregate mappings. The original descriptor is used only for creating clones and after that mapping never uses it. Some initialization is done in postInitialize to ensure the target descriptor's references are initialized.
Overrides:
initialize in class CollectionMapping
Throws:
DescriptorException

initializeChildInheritance

public void initializeChildInheritance(Descriptor parentDescriptor,
                                       oracle.toplink.publicinterface.Session session)
                                throws DescriptorException
INTERNAL: For aggregate mapping the reference descriptor is cloned. Also the involved inheritanced descriptor, its childern and parents all need to be cloned. The cloned descriptors are then assigned primary keys and table names before initialize. Once cloned descriptor is initialized it is assigned as reference descriptor in the aggregate mapping. This is a very specifiec behaviour for aggregate mappings. The original descriptor is used only for creating clones and after that mapping never uses it. Some initialization is done in postInitialize to ensure the target descriptor's references are initialized.
Throws:
DescriptorException

initializeParentInheritance

public void initializeParentInheritance(Descriptor parentDescriptor,
Descriptor childDescriptor,
                                        oracle.toplink.publicinterface.Session session)
                                 throws DescriptorException
INTERNAL: For aggregate mapping the reference descriptor is cloned. Also the involved inheritanced descriptor, its childern and parents all need to be cloned. The cloned descriptors are then assigned primary keys and table names before initialize. Once cloned descriptor is initialized it is assigned as reference descriptor in the aggregate mapping. This is a very specifiec behaviour for aggregate mappings. The original descriptor is used only for creating clones and after that mapping never uses it. Some initialization is done in postInitialize to ensure the target descriptor's references are initialized.
Throws:
DescriptorException

isAggregateCollectionMapping

public boolean isAggregateCollectionMapping()
INTERNAL:
Overrides:
isAggregateCollectionMapping in class DatabaseMapping

isPrivateOwned

public boolean isPrivateOwned()
INTERNAL:
Overrides:
isPrivateOwned in class ForeignReferenceMapping

mergeChangesIntoObject

public void mergeChangesIntoObject(java.lang.Object target,
                                   oracle.toplink.internal.sessions.ChangeRecord changeRecord,
                                   java.lang.Object source,
                                   oracle.toplink.internal.sessions.MergeManager mergeManager)
INTERNAL: Merge changes from the source to the target object. Because this is a collection mapping, values are added to or removed from the collection based on the changeset
Overrides:
mergeChangesIntoObject in class CollectionMapping

mergeIntoObject

public void mergeIntoObject(java.lang.Object target,
                            boolean isTargetUnInitialized,
                            java.lang.Object source,
                            oracle.toplink.internal.sessions.MergeManager mergeManager)
INTERNAL: Merge changes from the source to the target object.
Overrides:
mergeIntoObject in class CollectionMapping

postInitialize

public void postInitialize(oracle.toplink.publicinterface.Session session)
                    throws DescriptorException
INTERNAL: For aggregate collection mapping the reference descriptor is cloned. The cloned descriptor is then assigned primary keys and table names before initialize. Once cloned descriptor is initialized it is assigned as reference descriptor in the aggregate mapping. This is a very specifiec behaviour for aggregate mappings. The original descriptor is used only for creating clones and after that 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

postInsert

public void postInsert(WriteObjectQuery query)
                throws DatabaseException,
OptimisticLockException
INTERNAL: Insert privately owned parts
Overrides:
postInsert in class DatabaseMapping
Throws:
DatabaseException
OptimisticLockException

postUpdate

public void postUpdate(WriteObjectQuery writeQuery)
                throws DatabaseException,
OptimisticLockException
INTERNAL: Update the privately owned parts
Overrides:
postUpdate in class DatabaseMapping
Throws:
DatabaseException
OptimisticLockException

preDelete

public void preDelete(DeleteObjectQuery query)
               throws DatabaseException,
OptimisticLockException
INTERNAL: Delete privately owned parts
Overrides:
preDelete in class DatabaseMapping
Throws:
DatabaseException
OptimisticLockException

preInsert

public void preInsert(WriteObjectQuery query)
               throws DatabaseException,
OptimisticLockException
INTERNAL: The message is passed to its reference class descriptor.
Overrides:
preInsert in class DatabaseMapping
Throws:
DatabaseException
OptimisticLockException

prepareModifyQuery

public void prepareModifyQuery(ObjectLevelModifyQuery originalQuery,
ObjectLevelModifyQuery modifyQuery,
                               java.lang.Object object)
INTERNAL: setup the modifyQuery for post insert/update and pre delete

prepareModifyQueryForDelete

public void prepareModifyQueryForDelete(ObjectLevelModifyQuery originalQuery,
ObjectLevelModifyQuery modifyQuery,
                                        java.lang.Object object)
INTERNAL: setup the modifyQuery for pre delete

prepareModifyQueryForUpdate

public void prepareModifyQueryForUpdate(ObjectLevelModifyQuery originalQuery,
ObjectLevelModifyQuery modifyQuery,
                                        java.lang.Object object)
INTERNAL: setup the modifyQuery for update,

setSourceKeyFieldNames

public void setSourceKeyFieldNames(java.util.Vector fieldNames)
PUBLIC: Set the source key field names associated with the mapping. These must be in-order with the targetForeignKeyFieldNames.

setTargetForeignKeyFieldNames

public void setTargetForeignKeyFieldNames(java.util.Vector fieldNames)
PUBLIC: Set the target foregin key field names associated with the mapping. These must be in-order with the sourceKeyFieldNames.

simpleAddToCollectionChangeRecord

public void simpleAddToCollectionChangeRecord(java.lang.Object referenceKey,
                                              java.lang.Object changeSetToAdd,
                                              oracle.toplink.internal.sessions.ObjectChangeSet changeSet,
                                              oracle.toplink.publicinterface.Session session)
ADVANCED: This method is used to have an object add to a collection once the changeSet is applied The referenceKey parameter should only be used for direct Maps. PLEASE ENSURE that the changes have been made in the object model first.
Overrides:
simpleAddToCollectionChangeRecord in class CollectionMapping

simpleRemoveFromCollectionChangeRecord

public void simpleRemoveFromCollectionChangeRecord(java.lang.Object referenceKey,
                                                   java.lang.Object changeSetToRemove,
                                                   oracle.toplink.internal.sessions.ObjectChangeSet changeSet,
                                                   oracle.toplink.publicinterface.Session session)
ADVANCED: This method is used to have an object removed from a collection once the changeSet is applied The referenceKey parameter should only be used for direct Maps. PLEASE ENSURE that the changes have been made in the object model first.
Overrides:
simpleRemoveFromCollectionChangeRecord in class CollectionMapping

valueFromRow

public java.lang.Object valueFromRow(DatabaseRow row,
ObjectLevelReadQuery sourceQuery)
                              throws DatabaseException
INTERNAL: Retrieves a value from the row for a particular query key
Overrides:
valueFromRow in class ForeignReferenceMapping
Throws:
DatabaseException

verifyDelete

public boolean verifyDelete(java.lang.Object object,
                            oracle.toplink.publicinterface.Session session)
                     throws DatabaseException
INTERNAL: Checks if object is deleted from the database or not.
Overrides:
verifyDelete in class CollectionMapping
Throws:
DatabaseException

Copyright © 1998, 2004 Oracle Corporation. All Rights Reserved.