Oracle Application Server TopLink API Reference
10g (9.0.4.3)

B10491-02

oracle.toplink.sdk
Class SDKObjectCollectionMapping

java.lang.Object
  extended byoracle.toplink.mappings.DatabaseMapping
      extended byoracle.toplink.mappings.ForeignReferenceMapping
          extended byoracle.toplink.mappings.CollectionMapping
              extended byoracle.toplink.sdk.SDKObjectCollectionMapping

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

public class SDKObjectCollectionMapping
extends CollectionMapping
implements SDKCollectionMapping

SDKObjectCollectionMapping is used to represent a relationship between a single source object and collection of target objects; where, on the data store, the source object has a collection of references (foreign keys) to the target objects. The parent database row stores the nested foreign keys in database rows in an SDKFieldValue.

Since:
TOPLink/Java 3.0
See Also:
SDKDescriptor, SDKFieldValue, SDKCollectionMappingHelper, SDKCollectionChangeRecord, SDKOrderedCollectionChangeRecord, Serialized Form

Constructor Summary
SDKObjectCollectionMapping()
          Default constructor.

 

Method Summary
 void addAscendingOrdering(java.lang.String queryKeyName)
          PUBLIC: Currently, the TOPLink SDK does not support query result ordering.
 void addDescendingOrdering(java.lang.String queryKeyName)
          PUBLIC: Currently, the TOPLink SDK does not support query result ordering.
 void addSourceForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName, java.lang.String targetKeyFieldName)
          PUBLIC: Define the source foreign key relationship in the one-to-many mapping.
 java.lang.Object buildAddedElementFromChangeSet(java.lang.Object changeSet, oracle.toplink.internal.sessions.MergeManager mergeManager)
          INTERNAL: Build and return a new element based on the change set.
 java.lang.Object buildChangeSet(java.lang.Object element, oracle.toplink.internal.sessions.ObjectChangeSet owner, oracle.toplink.publicinterface.Session session)
          INTERNAL: Build and return a change set for the specified element.
 java.lang.Object buildElementFromElement(java.lang.Object element, oracle.toplink.internal.sessions.MergeManager mergeManager)
          INTERNAL: Build and return a new element based on the specified element.
 java.lang.Object buildRemovedElementFromChangeSet(java.lang.Object changeSet, oracle.toplink.internal.sessions.MergeManager mergeManager)
          INTERNAL: Build and return a new element based on the change set.
 java.lang.Object clone()
          INTERNAL: Clone the appropriate attributes.
 boolean compareElements(java.lang.Object element1, java.lang.Object element2, oracle.toplink.publicinterface.Session session)
          INTERNAL: Compare the non-null elements and return true if they are alike.
 boolean compareElementsForChange(java.lang.Object element1, java.lang.Object element2, oracle.toplink.publicinterface.Session session)
          INTERNAL: Compare the non-null elements and return true if they are alike.
 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: Compare the changes between two collections.
 boolean compareObjects(java.lang.Object object1, java.lang.Object object2, oracle.toplink.publicinterface.Session session)
          INTERNAL: Compare the attributes belonging to this mapping for the objects.
 java.util.Vector extractForeignKeyRows(DatabaseRow row, oracle.toplink.publicinterface.Session session)
          INTERNAL: Extract the collection of rows holding the foreign keys from the specified row.
 oracle.toplink.internal.helper.DatabaseField getField()
          INTERNAL: Return the field mapped by the mapping.
 java.lang.String getFieldName()
          PUBLIC: Return the name of the field mapped by the mapping.
 java.util.Vector getOrderedForeignKeyFields()
          INTERNAL: Return a vector of the foreign key fields in the same order as the corresponding primary key fields are in their descriptor.
 java.lang.String getReferenceDataTypeName()
          PUBLIC: Return the "data type" of the reference objects.
 java.util.Vector getSourceForeignKeyFields()
          INTERNAL: Return the source foreign key fields.
 java.util.Vector getTargetKeyFields()
          INTERNAL: Return the target key fields.
 boolean hasConstraintDependency()
          INTERNAL: Return whether the mapping has any constraint dependencies, such as foreign keys.
 void initialize(oracle.toplink.publicinterface.Session session)
          INTERNAL: Initialize the mapping.
 boolean isAggregateCollectionMapping()
          INTERNAL: Related mapping should implement this method to return true.
 boolean mapKeyHasChanged(java.lang.Object element, oracle.toplink.publicinterface.Session session)
          INTERNAL: Return whether the element's user-defined Map key has changed since it was cloned from the original version.
 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 postDelete(DeleteObjectQuery query)
          INTERNAL: Delete the reference objects.
 void preInsert(WriteObjectQuery query)
          INTERNAL: Insert privately owned parts
 void preUpdate(WriteObjectQuery query)
          INTERNAL: Update the privately owned parts.
 void setFieldName(java.lang.String fieldName)
          PUBLIC: Set the name of the field mapped by the mapping.
 void setReferenceDataTypeName(java.lang.String referenceDataTypeName)
          PUBLIC: Set the "data type" of the reference objects.
 void setSelectionCall(SDKCall call)
          PUBLIC: Set the custom call that will perform the read query to read all the related objects.
 void setSourceForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName)
          PUBLIC: Define the source foreign key relationship in the one-to-many mapping.
 void setSourceForeignKeyFieldNames(java.lang.String[] sourceForeignKeyFieldNames, java.lang.String[] targetKeyFieldNames)
          PUBLIC: Define the source foreign key relationship in the one-to-many mapping.
 void setUsesBatchReading(boolean usesBatchReading)
          PUBLIC: Currently, the TOPLink SDK does not support batch reading.
 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.
 void writeFromObjectIntoRow(java.lang.Object object, DatabaseRow row, oracle.toplink.publicinterface.Session session)
          INTERNAL: Get the appropriate attribute value from the object and put it in the appropriate field of the database row.
 void writeFromObjectIntoRowForShallowInsert(java.lang.Object object, DatabaseRow row, oracle.toplink.publicinterface.Session session)
          INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts.
 void writeFromObjectIntoRowForShallowInsertWithChangeRecord(oracle.toplink.internal.sessions.ChangeRecord changeRecord, DatabaseRow row, oracle.toplink.publicinterface.Session session)
          INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts.
 void writeFromObjectIntoRowForUpdate(WriteObjectQuery writeQuery, DatabaseRow row)
          INTERNAL: If any of the references objects has changed, write out all the keys.
 void writeFromObjectIntoRowWithChangeRecord(oracle.toplink.internal.sessions.ChangeRecord changeRecord, DatabaseRow row, oracle.toplink.publicinterface.Session session)
          INTERNAL: Get the appropriate attribute value from the object and put it in the appropriate field of the database row.
 void writeInsertFieldsIntoRow(DatabaseRow row, oracle.toplink.publicinterface.Session session)
          INTERNAL: Write fields needed for insert into the template for with null values.

 

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

 

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

 

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

 

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

 

Methods inherited from interface oracle.toplink.sdk.SDKCollectionMapping
getAttributeName, getRealCollectionAttributeValueFromObject, setRealAttributeValueInObject

 

Methods inherited from interface oracle.toplink.mappings.ContainerMapping
getContainerPolicy, setContainerPolicy, useCollectionClass, useMapClass

 

Constructor Detail

SDKObjectCollectionMapping

public SDKObjectCollectionMapping()
Default constructor.
Method Detail

addAscendingOrdering

public void addAscendingOrdering(java.lang.String queryKeyName)
PUBLIC: Currently, the TOPLink SDK does not support query result ordering.
Overrides:
addAscendingOrdering in class CollectionMapping

addDescendingOrdering

public void addDescendingOrdering(java.lang.String queryKeyName)
PUBLIC: Currently, the TOPLink SDK does not support query result ordering.
Overrides:
addDescendingOrdering in class CollectionMapping

addSourceForeignKeyFieldName

public void addSourceForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName,
                                         java.lang.String targetKeyFieldName)
PUBLIC: Define the source foreign key relationship in the one-to-many mapping. This method is used for composite source foreign key relationships. That is, the source object's table has multiple foreign key fields that are references to the target object's (typically primary) key fields. Both the source foreign key field name and the corresponding target primary key field name must be specified.

buildAddedElementFromChangeSet

public java.lang.Object buildAddedElementFromChangeSet(java.lang.Object changeSet,
                                                       oracle.toplink.internal.sessions.MergeManager mergeManager)
INTERNAL: Build and return a new element based on the change set.
Specified by:
buildAddedElementFromChangeSet in interface SDKCollectionMapping

buildChangeSet

public java.lang.Object buildChangeSet(java.lang.Object element,
                                       oracle.toplink.internal.sessions.ObjectChangeSet owner,
                                       oracle.toplink.publicinterface.Session session)
INTERNAL: Build and return a change set for the specified element.
Specified by:
buildChangeSet in interface SDKCollectionMapping

buildElementFromElement

public java.lang.Object buildElementFromElement(java.lang.Object element,
                                                oracle.toplink.internal.sessions.MergeManager mergeManager)
INTERNAL: Build and return a new element based on the specified element.
Specified by:
buildElementFromElement in interface SDKCollectionMapping

buildRemovedElementFromChangeSet

public java.lang.Object buildRemovedElementFromChangeSet(java.lang.Object changeSet,
                                                         oracle.toplink.internal.sessions.MergeManager mergeManager)
INTERNAL: Build and return a new element based on the change set.
Specified by:
buildRemovedElementFromChangeSet in interface SDKCollectionMapping

clone

public java.lang.Object clone()
INTERNAL: Clone the appropriate attributes.
Overrides:
clone in class ForeignReferenceMapping

compareElements

public boolean compareElements(java.lang.Object element1,
                               java.lang.Object element2,
                               oracle.toplink.publicinterface.Session session)
INTERNAL: Compare the non-null elements and return true if they are alike.
Specified by:
compareElements in interface SDKCollectionMapping

compareElementsForChange

public boolean compareElementsForChange(java.lang.Object element1,
                                        java.lang.Object element2,
                                        oracle.toplink.publicinterface.Session session)
INTERNAL: Compare the non-null elements and return true if they are alike. Here we use object identity.
Specified by:
compareElementsForChange in interface SDKCollectionMapping

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: Compare the changes between two collections. Element comparisons are made using identity and, when appropriate, the value of the element's key for the Map container.
Overrides:
compareForChange in class CollectionMapping
Returns:
prototype.changeset.ChangeRecord

compareObjects

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

extractForeignKeyRows

public java.util.Vector extractForeignKeyRows(DatabaseRow row,
                                              oracle.toplink.publicinterface.Session session)
INTERNAL: Extract the collection of rows holding the foreign keys from the specified row.

getField

public oracle.toplink.internal.helper.DatabaseField getField()
INTERNAL: Return the field mapped by the mapping.
Overrides:
getField in class DatabaseMapping

getFieldName

public java.lang.String getFieldName()
PUBLIC: Return the name of the field mapped by the mapping.

getOrderedForeignKeyFields

public java.util.Vector getOrderedForeignKeyFields()
INTERNAL: Return a vector of the foreign key fields in the same order as the corresponding primary key fields are in their descriptor.

getReferenceDataTypeName

public java.lang.String getReferenceDataTypeName()
PUBLIC: Return the "data type" of the reference objects. Depending on the data store, this could be optional.

getSourceForeignKeyFields

public java.util.Vector getSourceForeignKeyFields()
INTERNAL: Return the source foreign key fields.

getTargetKeyFields

public java.util.Vector getTargetKeyFields()
INTERNAL: Return the target key fields.

hasConstraintDependency

public boolean hasConstraintDependency()
INTERNAL: Return whether the mapping has any constraint dependencies, such as foreign keys.
Overrides:
hasConstraintDependency in class DatabaseMapping

initialize

public void initialize(oracle.toplink.publicinterface.Session session)
                throws DescriptorException
INTERNAL: Initialize the mapping.
Overrides:
initialize in class CollectionMapping
Throws:
DescriptorException

isAggregateCollectionMapping

public boolean isAggregateCollectionMapping()
Description copied from class: DatabaseMapping
INTERNAL: Related mapping should implement this method to return true.
Overrides:
isAggregateCollectionMapping in class DatabaseMapping

mapKeyHasChanged

public boolean mapKeyHasChanged(java.lang.Object element,
                                oracle.toplink.publicinterface.Session session)
INTERNAL: Return whether the element's user-defined Map key has changed since it was cloned from the original version. Object elements can change their keys without detection. Get the original object and compare keys.
Specified by:
mapKeyHasChanged in interface SDKCollectionMapping

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.
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. Simply replace the entire target collection.
Overrides:
mergeIntoObject in class CollectionMapping

postDelete

public void postDelete(DeleteObjectQuery query)
                throws DatabaseException,
OptimisticLockException
INTERNAL: Delete the reference objects.
Overrides:
postDelete in class DatabaseMapping
Throws:
DatabaseException
OptimisticLockException

preInsert

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

preUpdate

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

setFieldName

public void setFieldName(java.lang.String fieldName)
PUBLIC: Set the name of the field mapped by the mapping.

setReferenceDataTypeName

public void setReferenceDataTypeName(java.lang.String referenceDataTypeName)
PUBLIC: Set the "data type" of the reference objects. Depending on the data store, this could be optional.

setSelectionCall

public void setSelectionCall(SDKCall call)
PUBLIC: Set the custom call that will perform the read query to read all the related objects.

setSourceForeignKeyFieldName

public void setSourceForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName)
PUBLIC: Define the source foreign key relationship in the one-to-many mapping. This method can be used when the foreign and primary keys have only a single field each. (Use #addSourceForeignKeyFieldName(String, String) #setSourceForeignKeyFieldNames(String[], String[]) for "composite" keys.) Only the source foreign key field name is specified and the target (primary) key field is assumed to be the primary key of the target object.

setSourceForeignKeyFieldNames

public void setSourceForeignKeyFieldNames(java.lang.String[] sourceForeignKeyFieldNames,
                                          java.lang.String[] targetKeyFieldNames)
PUBLIC: Define the source foreign key relationship in the one-to-many mapping. This method is used for composite source foreign key relationships. That is, the source object's table has multiple foreign key fields to the target object's (typically primary) key fields. Both the source foreign key field names and the corresponding target primary key field names must be specified.

setUsesBatchReading

public void setUsesBatchReading(boolean usesBatchReading)
PUBLIC: Currently, the TOPLink SDK does not support batch reading.
Overrides:
setUsesBatchReading in class ForeignReferenceMapping

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.
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.
Overrides:
simpleRemoveFromCollectionChangeRecord in class CollectionMapping

writeFromObjectIntoRow

public void writeFromObjectIntoRow(java.lang.Object object,
DatabaseRow row,
                                   oracle.toplink.publicinterface.Session session)
INTERNAL: Get the appropriate attribute value from the object and put it in the appropriate field of the database row. Loop through the reference objects and extract the primary keys and put them in the vector of "nested" rows.
Overrides:
writeFromObjectIntoRow in class DatabaseMapping

writeFromObjectIntoRowForShallowInsert

public void writeFromObjectIntoRowForShallowInsert(java.lang.Object object,
DatabaseRow row,
                                                   oracle.toplink.publicinterface.Session session)
INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts. The foreign keys must be set to null to avoid constraints.
Overrides:
writeFromObjectIntoRowForShallowInsert in class DatabaseMapping

writeFromObjectIntoRowForShallowInsertWithChangeRecord

public void writeFromObjectIntoRowForShallowInsertWithChangeRecord(oracle.toplink.internal.sessions.ChangeRecord changeRecord,
DatabaseRow row,
                                                                   oracle.toplink.publicinterface.Session session)
INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts. The foreign keys must be set to null to avoid constraints.
Overrides:
writeFromObjectIntoRowForShallowInsertWithChangeRecord in class DatabaseMapping

writeFromObjectIntoRowForUpdate

public void writeFromObjectIntoRowForUpdate(WriteObjectQuery writeQuery,
DatabaseRow row)
                                     throws DescriptorException
INTERNAL: If any of the references objects has changed, write out all the keys.
Overrides:
writeFromObjectIntoRowForUpdate in class DatabaseMapping
Throws:
DescriptorException

writeFromObjectIntoRowWithChangeRecord

public void writeFromObjectIntoRowWithChangeRecord(oracle.toplink.internal.sessions.ChangeRecord changeRecord,
DatabaseRow row,
                                                   oracle.toplink.publicinterface.Session session)
INTERNAL: Get the appropriate attribute value from the object and put it in the appropriate field of the database row. Loop through the reference objects and extract the primary keys and put them in the vector of "nested" rows.
Overrides:
writeFromObjectIntoRowWithChangeRecord in class DatabaseMapping

writeInsertFieldsIntoRow

public void writeInsertFieldsIntoRow(DatabaseRow row,
                                     oracle.toplink.publicinterface.Session session)
INTERNAL: Write fields needed for insert into the template for with null values.
Overrides:
writeInsertFieldsIntoRow in class DatabaseMapping

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