EclipseLink1.0 - 20080707 API Reference

org.eclipse.persistence.mappings
Class OneToManyMapping

java.lang.Object
  extended by org.eclipse.persistence.mappings.DatabaseMapping
      extended by org.eclipse.persistence.mappings.ForeignReferenceMapping
          extended by org.eclipse.persistence.mappings.CollectionMapping
              extended by org.eclipse.persistence.mappings.OneToManyMapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ContainerMapping, RelationalMapping

public class OneToManyMapping
extends CollectionMapping
implements RelationalMapping

Purpose: This mapping is used to represent the typical RDBMS relationship between a single source object and collection of target objects; where, on the database, the target objects have references (foreign keys) to the source object.

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

Field Summary
protected  java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceKeyFields
          The (typically primary) source key fields that are referenced by the targetForeignKeyFields.
protected  java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> sourceKeysToTargetForeignKeys
          This maps the (primary) source key fields to the corresponding target foreign key fields.
protected  java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeyFields
          The target foreign key fields that reference the sourceKeyFields.
protected  java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeysToSourceKeys
          This maps the target foreign key fields to the corresponding (primary) source key fields.
 
Fields inherited from class org.eclipse.persistence.mappings.CollectionMapping
containerPolicy, deleteAllQuery, hasCustomDeleteAllQuery, hasOrderBy
 
Fields inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping
cascadeMerge, cascadePersist, cascadeRefresh, cascadeRemove, hasCustomSelectionQuery, indirectionPolicy, INNER_JOIN, isPrivateOwned, joinFetch, NONE, OUTER_JOIN, referenceClass, referenceClassName, referenceDescriptor, relationshipPartner, relationshipPartnerAttributeName, selectionQuery, tempInitSession, usesBatchReading
 
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
OneToManyMapping()
          PUBLIC: Default constructor.
 
Method Summary
 void addTargetForeignKeyField(org.eclipse.persistence.internal.helper.DatabaseField targetForeignKeyField, org.eclipse.persistence.internal.helper.DatabaseField sourceKeyField)
          INTERNAL: Add the associated fields to the appropriate collections.
 void addTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName, java.lang.String sourceKeyFieldName)
          PUBLIC: Define the target foreign key relationship in the one-to-many mapping.
protected  Expression buildDefaultSelectionCriteria()
          The selection criteria are created with target foreign keys and source "primary" keys.
 Expression buildSelectionCriteria()
          This method would allow customers to get the potential selection criteria for a mapping prior to initialization.
 java.lang.Object clone()
          INTERNAL: Clone the appropriate attributes.
protected  void deleteAll(DeleteObjectQuery query)
          Delete all the reference objects with a single query.
protected  void deleteReferenceObjectsLeftOnDatabase(DeleteObjectQuery query)
          This method will make sure that all the records privately owned by this mapping are actually removed.
protected  java.util.Hashtable executeBatchQuery(DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord row)
          We need to execute the batch query and store the results in a hash table keyed by the (primary) keys of the source objects.
protected  java.util.Vector extractForeignKeyFromReferenceObject(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
          Extract the foreign key value from the reference object.
protected  java.util.Vector extractKeyFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session)
          Extract the key field values from the specified row.
 java.lang.Object extractResultFromBatchQuery(DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord argumentRow)
          INTERNAL: Extract the value from the batch optimized query.
 java.util.Vector getSourceKeyFieldNames()
          PUBLIC: Return the source key field names associated with the mapping.
 java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> getSourceKeyFields()
          INTERNAL: Return the source key fields.
 java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getSourceKeysToTargetForeignKeys()
          INTERNAL: Return the source/target key fields.
 java.util.Vector getTargetForeignKeyFieldNames()
          INTERNAL: Return the target foreign key field names associated with the mapping.
 java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> getTargetForeignKeyFields()
          INTERNAL: Return the target foreign key fields.
 java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getTargetForeignKeysToSourceKeys()
          INTERNAL: Return the target/source key fields.
 java.util.Map getTargetForeignKeyToSourceKeys()
          INTERNAL: Maintain for backward compatibility.
 boolean hasInverseConstraintDependency()
          INTERNAL: Return whether the mapping has any inverse constraint dependencies, such as foreign keys and join tables.
 void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Initialize the mapping.
protected  void initializeDeleteAllQuery()
          Initialize the delete all query.
protected  void initializeTargetForeignKeysToSourceKeys()
          Verify, munge, and hash the target foreign keys and source keys.
 boolean isCascadedLockingSupported()
          INTERNAL Return true if this mapping supports cascaded version optimistic locking.
 boolean isJoiningSupported()
          INTERNAL: Return if this mapping support joining.
 boolean isOneToManyMapping()
          INTERNAL:
 boolean isRelationalMapping()
          INTERNAL:
protected  boolean isSourceKeySpecified()
          Return whether the source key is specified.
protected  boolean mustDeleteReferenceObjectsOneByOne()
          Return whether the reference objects must be deleted one by one, as opposed to with a single DELETE statement.
 void postInsert(WriteObjectQuery query)
          INTERNAL: Insert the reference objects.
 void postUpdate(WriteObjectQuery query)
          INTERNAL: Update the reference objects.
 void preDelete(DeleteObjectQuery query)
          INTERNAL: Delete the reference objects.
 void prepareCascadeLockingPolicy()
          Prepare a cascade locking policy.
 void setDeleteAllSQLString(java.lang.String sqlString)
          PUBLIC: Set the SQL string used by the mapping to delete the target objects.
 void setSourceKeyFieldNames(java.util.Vector fieldNames)
          INTERNAL: Set the source key field names associated with the mapping.
 void setSourceKeyFields(java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceKeyFields)
          INTERNAL: Set the source key fields.
 void setTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName)
          PUBLIC: Define the target foreign key relationship in the one-to-many mapping.
 void setTargetForeignKeyFieldNames(java.lang.String[] targetForeignKeyFieldNames, java.lang.String[] sourceKeyFieldNames)
          PUBLIC: Define the target foreign key relationship in the one-to-many mapping.
 void setTargetForeignKeyFieldNames(java.util.Vector fieldNames)
          INTERNAL: Set the target key field names associated with the mapping.
 void setTargetForeignKeyFields(java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeyFields)
          INTERNAL: Set the target fields.
protected  void setTargetForeignKeysToSourceKeys(java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeysToSourceKeys)
          INTERNAL: Set the target fields.
protected  boolean shouldObjectModifyCascadeToParts(ObjectLevelModifyQuery query)
          Return whether any process leading to object modification should also affect its parts.
 boolean verifyDelete(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Used to verify whether the specified object is deleted or not.
 
Methods inherited from class org.eclipse.persistence.mappings.CollectionMapping
addAggregateOrderBy, addAscendingOrdering, addDescendingOrdering, addOrderBy, addToCollectionChangeRecord, buildBackupCloneForPartObject, buildChangeRecord, buildCloneForPartObject, buildCopy, buildElementClone, calculateDeferredChanges, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadeMerge, cascadePerformRemoveIfRequired, cascadeRegisterNewIfRequired, compareCollectionsForChange, compareForChange, compareObjects, compareObjectsAndWrite, compareObjectsWithoutPrivateOwned, compareObjectsWithPrivateOwned, convertClassNamesToClasses, fixRealObjectReferences, getContainerPolicy, getDeleteAllQuery, getObjectCorrespondingTo, getOrderByQueryKeyExpressions, getRealAttributeValueFromObject, getRealCollectionAttributeValueFromObject, hasCustomDeleteAllQuery, hasOrderBy, isAttributeValueInstantiatedOrChanged, isChangeTrackingSupported, isCollectionMapping, iterateOnElement, iterateOnRealAttributeValue, mergeChangesIntoObject, mergeIntoObject, objectAddedDuringUpdate, objectRemovedDuringUpdate, objectUnchangedDuringUpdate, objectUnchangedDuringUpdate, prepareTranslationRow, readPrivateOwnedForObject, removeFromCollectionChangeRecord, replaceValueHoldersIn, setChangeListener, setContainerPolicy, setCustomDeleteAllQuery, setDeleteAllCall, setDeleteAllQuery, setHasCustomDeleteAllQuery, setSelectionQueryContainerPolicy, setSessionName, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, updateChangeRecord, useCollectionClass, useCollectionClassName, useListClassName, useMapClass, useMapClass, useMapClassName, useSortedSetClass, useSortedSetClassName, useSortedSetClassName, useTransparentCollection, useTransparentList, useTransparentMap, useTransparentSet, validateBeforeInitialization, valueFromRowInternalWithJoin
 
Methods inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping
batchedValueFromRow, buildBackupClone, buildClone, buildCloneFromRow, createUnitOfWorkValueHolder, dontDoMerge, dontUseBatchReading, dontUseIndirection, fixObjectReferences, getAttributeValueFromObject, getAttributeValueWithClonedValueHolders, getBatchReadObjects, getIndirectionPolicy, getJoinCriteria, getJoinFetch, getReferenceClass, getReferenceClassName, getReferenceDescriptor, getRelationshipPartner, getRelationshipPartnerAttributeName, getSelectionCriteria, getSelectionQuery, getTempSession, getValueFromRemoteValueHolder, hasCustomSelectionQuery, initializeReferenceDescriptor, initializeSelectionQuery, instantiateAttribute, isAttributeValueInstantiated, isCascadeMerge, isCascadePersist, isCascadeRefresh, isCascadeRemove, isForeignReferenceMapping, isInnerJoinFetched, isJoinFetched, isLazy, isOuterJoinFetched, isPrivateOwned, iterate, mergeRemoteValueHolder, postPrepareNestedBatchQuery, preInitialize, prepareHistoricalQuery, prepareNestedBatchQuery, prepareNestedJoinQueryClone, prepareNestedJoins, privateOwnedRelationship, remoteInitialization, setBatchReadObjects, setCascadeAll, setCascadeMerge, setCascadePersist, setCascadeRefresh, setCascadeRemove, setCustomSelectionQuery, setHasCustomSelectionQuery, setIndirectionPolicy, setIsPrivateOwned, setJoinFetch, setRealAttributeValueInObject, setReferenceClass, setReferenceClassName, setReferenceDescriptor, setRelationshipPartner, setRelationshipPartnerAttributeName, setSelectionCall, setSelectionCriteria, setSelectionQuery, setSelectionSQLString, setTempSession, setUsesBatchReading, setUsesIndirection, shouldInitializeSelectionCriteria, shouldMergeCascadeParts, shouldMergeCascadeReference, shouldUseBatchReading, shouldUseValueFromRowWithJoin, trimRowForJoin, trimRowForJoin, useBasicIndirection, useBatchReading, useContainerIndirection, useInnerJoinFetch, useOuterJoinFetch, usesIndirection, useWeavedIndirection, valueFromRow, valueFromRowInternal
 
Methods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
buildExpression, buildObjectJoinExpression, buildObjectJoinExpression, buildShallowOriginalFromRow, cloneFields, collectFields, extractNestedExpressions, getAttributeAccessor, getAttributeClassification, getAttributeName, getDescriptor, getField, getFieldClassification, getFields, getGetMethodName, getProperties, getProperty, getSelectFields, getSelectTables, getSetMethodName, getWeight, hasConstraintDependency, hasDependency, hasRootExpressionThatShouldUseOuterJoin, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isCloningRequired, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isManyToManyMapping, isNestedTableMapping, isObjectReferenceMapping, isOneToOneMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isReferenceMapping, isRemotelyInitialized, isStructureMapping, isTransformationMapping, isUsingMethodAccess, isVariableOneToOneMapping, isWriteOnly, isXMLMapping, performDataModificationEvent, postDelete, postInitialize, preInsert, preUpdate, readFromResultSetIntoObject, readFromRowIntoObject, readFromRowIntoObject, readOnly, readWrite, rehashFieldDependancies, remotelyInitialized, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setDescriptor, setFields, setGetMethodName, setIsLazy, setIsOptional, setIsPrimaryKeyMapping, setIsReadOnly, setProperties, setProperty, setSetMethodName, setWeight, toString, validateAfterInitialization, valueFromObject, valueFromResultSet, valueFromRow, writeFromAttributeIntoRow, writeFromObjectIntoRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdate, writeFromObjectIntoRowForWhereClause, writeFromObjectIntoRowWithChangeRecord, writeInsertFieldsIntoRow, writeUpdateFieldsIntoRow
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

targetForeignKeyFields

protected transient java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeyFields
The target foreign key fields that reference the sourceKeyFields.


sourceKeyFields

protected transient java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceKeyFields
The (typically primary) source key fields that are referenced by the targetForeignKeyFields.


targetForeignKeysToSourceKeys

protected transient java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeysToSourceKeys
This maps the target foreign key fields to the corresponding (primary) source key fields.


sourceKeysToTargetForeignKeys

protected transient java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> sourceKeysToTargetForeignKeys
This maps the (primary) source key fields to the corresponding target foreign key fields.

Constructor Detail

OneToManyMapping

public OneToManyMapping()
PUBLIC: Default constructor.

Method Detail

isRelationalMapping

public boolean isRelationalMapping()
INTERNAL:

Overrides:
isRelationalMapping in class DatabaseMapping

addTargetForeignKeyField

public void addTargetForeignKeyField(org.eclipse.persistence.internal.helper.DatabaseField targetForeignKeyField,
                                     org.eclipse.persistence.internal.helper.DatabaseField sourceKeyField)
INTERNAL: Add the associated fields to the appropriate collections.


addTargetForeignKeyFieldName

public void addTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName,
                                         java.lang.String sourceKeyFieldName)
PUBLIC: Define the target foreign key relationship in the one-to-many mapping. This method is used for composite target foreign key relationships. That is, the target object's table has multiple foreign key fields that are references to the source object's (typically primary) key fields. Both the target foreign key field name and the corresponding source primary key field name must be specified. Because the target object's table must store a foreign key to the source table, the target object must map that foreign key, this is normally done through a one-to-one mapping back-reference. Other options include:

See Also:
DirectToFieldMapping, ManyToManyMapping, AggregateCollectionMapping

buildDefaultSelectionCriteria

protected Expression buildDefaultSelectionCriteria()
The selection criteria are created with target foreign keys and source "primary" keys. These criteria are then used to read the target records from the table. These criteria are also used as the default "delete all" criteria. CR#3922 - This method is almost the same as buildSelectionCriteria() the difference is that TargetForeignKeysToSourceKeys contains more information after login then SourceKeyFields contains before login.


buildSelectionCriteria

public Expression buildSelectionCriteria()
This method would allow customers to get the potential selection criteria for a mapping prior to initialization. This would allow them to more easily create an ammendment method that would ammend the SQL for the join. CR#3922 - This method is almost the same as buildDefaultSelectionCriteria() the difference is that TargetForeignKeysToSourceKeys contains more information after login then SourceKeyFields contains before login.


clone

public java.lang.Object clone()
INTERNAL: Clone the appropriate attributes.

Overrides:
clone in class ForeignReferenceMapping

deleteAll

protected void deleteAll(DeleteObjectQuery query)
                  throws DatabaseException
Delete all the reference objects with a single query.

Throws:
DatabaseException

deleteReferenceObjectsLeftOnDatabase

protected void deleteReferenceObjectsLeftOnDatabase(DeleteObjectQuery query)
                                             throws DatabaseException,
                                                    OptimisticLockException
This method will make sure that all the records privately owned by this mapping are actually removed. If such records are found then those are all read and removed one by one along with their privately owned parts.

Throws:
DatabaseException
OptimisticLockException

executeBatchQuery

protected java.util.Hashtable executeBatchQuery(DatabaseQuery query,
                                                org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                org.eclipse.persistence.internal.sessions.AbstractRecord row)
We need to execute the batch query and store the results in a hash table keyed by the (primary) keys of the source objects.


extractForeignKeyFromReferenceObject

protected java.util.Vector extractForeignKeyFromReferenceObject(java.lang.Object object,
                                                                org.eclipse.persistence.internal.sessions.AbstractSession session)
Extract the foreign key value from the reference object. Used for batch reading. Keep the fields in the same order as in the targetForeignKeysToSourceKeys hashtable.


extractKeyFromRow

protected java.util.Vector extractKeyFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                             org.eclipse.persistence.internal.sessions.AbstractSession session)
Extract the key field values from the specified row. Used for batch reading. Keep the fields in the same order as in the targetForeignKeysToSourceKeys hashtable.


extractResultFromBatchQuery

public java.lang.Object extractResultFromBatchQuery(DatabaseQuery query,
                                                    org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                                    org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                    org.eclipse.persistence.internal.sessions.AbstractRecord argumentRow)
INTERNAL: Extract the value from the batch optimized query.

Overrides:
extractResultFromBatchQuery in class ForeignReferenceMapping

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<org.eclipse.persistence.internal.helper.DatabaseField> getSourceKeyFields()
INTERNAL: Return the source key fields.


getSourceKeysToTargetForeignKeys

public java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getSourceKeysToTargetForeignKeys()
INTERNAL: Return the source/target key fields.


getTargetForeignKeyFieldNames

public java.util.Vector getTargetForeignKeyFieldNames()
INTERNAL: Return the target foreign key field names associated with the mapping. These are in-order with the targetForeignKeyFieldNames.


getTargetForeignKeyFields

public java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> getTargetForeignKeyFields()
INTERNAL: Return the target foreign key fields.


getTargetForeignKeysToSourceKeys

public java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getTargetForeignKeysToSourceKeys()
INTERNAL: Return the target/source key fields.


getTargetForeignKeyToSourceKeys

public java.util.Map getTargetForeignKeyToSourceKeys()
INTERNAL: Maintain for backward compatibility. This is 'public' so StoredProcedureGenerator does not have to use the custom query expressions.


hasInverseConstraintDependency

public boolean hasInverseConstraintDependency()
INTERNAL: Return whether the mapping has any inverse constraint dependencies, such as foreign keys and join tables.

Overrides:
hasInverseConstraintDependency in class DatabaseMapping

initialize

public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
                throws DescriptorException
INTERNAL: Initialize the mapping.

Overrides:
initialize in class CollectionMapping
Throws:
DescriptorException

initializeDeleteAllQuery

protected void initializeDeleteAllQuery()
Initialize the delete all query. This query is used to delete the collection of objects from the database.


initializeTargetForeignKeysToSourceKeys

protected void initializeTargetForeignKeysToSourceKeys()
                                                throws DescriptorException
Verify, munge, and hash the target foreign keys and source keys.

Throws:
DescriptorException

isOneToManyMapping

public boolean isOneToManyMapping()
INTERNAL:

Overrides:
isOneToManyMapping in class DatabaseMapping

isSourceKeySpecified

protected boolean isSourceKeySpecified()
Return whether the source key is specified. It will be empty when #setTargetForeignKeyFieldName(String) is used.


mustDeleteReferenceObjectsOneByOne

protected boolean mustDeleteReferenceObjectsOneByOne()
Return whether the reference objects must be deleted one by one, as opposed to with a single DELETE statement.


postInsert

public void postInsert(WriteObjectQuery query)
                throws DatabaseException,
                       OptimisticLockException
INTERNAL: Insert the reference objects.

Overrides:
postInsert in class DatabaseMapping
Throws:
DatabaseException
OptimisticLockException

postUpdate

public void postUpdate(WriteObjectQuery query)
                throws DatabaseException,
                       OptimisticLockException
INTERNAL: Update the reference objects.

Overrides:
postUpdate in class DatabaseMapping
Throws:
DatabaseException
OptimisticLockException

preDelete

public void preDelete(DeleteObjectQuery query)
               throws DatabaseException,
                      OptimisticLockException
INTERNAL: Delete the reference objects.

Overrides:
preDelete in class DatabaseMapping
Throws:
DatabaseException
OptimisticLockException

prepareCascadeLockingPolicy

public void prepareCascadeLockingPolicy()
Prepare a cascade locking policy.

Overrides:
prepareCascadeLockingPolicy in class DatabaseMapping

setDeleteAllSQLString

public void setDeleteAllSQLString(java.lang.String sqlString)
PUBLIC: Set the SQL string used by the mapping to delete the target objects. This allows the developer to override the SQL generated by TopLink with a custom SQL statement or procedure call. The arguments are translated from the fields of the source row, by replacing the field names marked by '#' with the values for those fields at execution time. A one-to-many mapping will only use this delete all optimization if the target objects can be deleted in a single SQL call. This is possible when the target objects are in a single table, do not using locking, do not contain other privately-owned parts, do not read subclasses, etc.

Example: "delete from PHONE where OWNER_ID = #EMPLOYEE_ID"

Overrides:
setDeleteAllSQLString in class CollectionMapping

setSourceKeyFieldNames

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


setSourceKeyFields

public void setSourceKeyFields(java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceKeyFields)
INTERNAL: Set the source key fields.


setTargetForeignKeyFieldName

public void setTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName)
PUBLIC: Define the target 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 #addTargetForeignKeyFieldName(String, String) for "composite" keys.) Only the target foreign key field name is specified and the source (primary) key field is assumed to be the primary key of the source object. Because the target object's table must store a foreign key to the source table, the target object must map that foreign key, this is normally done through a one-to-one mapping back-reference. Other options include:

See Also:
DirectToFieldMapping, ManyToManyMapping, AggregateCollectionMapping

setTargetForeignKeyFieldNames

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


setTargetForeignKeyFieldNames

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


setTargetForeignKeyFields

public void setTargetForeignKeyFields(java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeyFields)
INTERNAL: Set the target fields.


setTargetForeignKeysToSourceKeys

protected void setTargetForeignKeysToSourceKeys(java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeysToSourceKeys)
INTERNAL: Set the target fields.


shouldObjectModifyCascadeToParts

protected boolean shouldObjectModifyCascadeToParts(ObjectLevelModifyQuery query)
Return whether any process leading to object modification should also affect its parts. Used by write, insert, update, and delete.

Overrides:
shouldObjectModifyCascadeToParts in class ForeignReferenceMapping

isCascadedLockingSupported

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

Overrides:
isCascadedLockingSupported in class DatabaseMapping

isJoiningSupported

public boolean isJoiningSupported()
INTERNAL: Return if this mapping support joining.

Overrides:
isJoiningSupported in class ForeignReferenceMapping

verifyDelete

public boolean verifyDelete(java.lang.Object object,
                            org.eclipse.persistence.internal.sessions.AbstractSession session)
                     throws DatabaseException
INTERNAL: Used to verify whether the specified object is deleted or not.

Overrides:
verifyDelete in class CollectionMapping
Throws:
DatabaseException

EclipseLink1.0 - 20080707 API Reference