Class OneToManyMapping
- java.lang.Object
-
- org.eclipse.persistence.core.mappings.CoreMapping<AttributeAccessor,org.eclipse.persistence.internal.sessions.AbstractSession,org.eclipse.persistence.internal.queries.ContainerPolicy,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField>
-
- org.eclipse.persistence.mappings.DatabaseMapping
-
- org.eclipse.persistence.mappings.ForeignReferenceMapping
-
- org.eclipse.persistence.mappings.CollectionMapping
-
- org.eclipse.persistence.mappings.OneToManyMapping
-
- All Implemented Interfaces:
Serializable
,Cloneable
,ContainerMapping
,MapComponentMapping
,RelationalMapping
- Direct Known Subclasses:
UnidirectionalOneToManyMapping
public class OneToManyMapping extends CollectionMapping implements RelationalMapping, MapComponentMapping
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.
- Since:
- TOPLink/Java 1.0
- Author:
- Sati
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.persistence.mappings.DatabaseMapping
DatabaseMapping.WriteType
-
-
Field Summary
-
Fields inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping
INNER_JOIN, NONE, OUTER_JOIN, QUERY_BATCH_PARAMETER
-
-
Constructor Summary
Constructors Constructor Description OneToManyMapping()
PUBLIC: Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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(String targetForeignKeyFieldName, String sourceKeyFieldName)
PUBLIC: Define the target foreign key relationship in the one-to-many mapping.Expression
buildSelectionCriteria()
This method would allow customers to get the potential selection criteria for a mapping prior to initialization.Object
clone()
INTERNAL: Clone the appropriate attributes.void
collectQueryParameters(Set<org.eclipse.persistence.internal.helper.DatabaseField> cacheFields)
INTERNAL: This method is used to store the FK fields that can be cached that correspond to noncacheable mappings the FK field values will be used to re-issue the query when cloning the shared cache entityObject
createMapComponentFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord dbRow, ObjectBuildingQuery query, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, org.eclipse.persistence.internal.sessions.AbstractSession session, boolean isTargetProtected)
INTERNAL Called when a DatabaseMapping is used to map the key in a collection.Collection
getFieldsForTranslationInAggregate()
INTERNAL: Return source key fields for translation by an AggregateObjectMappingVector
getSourceKeyFieldNames()
PUBLIC: Return the source key field names associated with the mapping.Vector<org.eclipse.persistence.internal.helper.DatabaseField>
getSourceKeyFields()
INTERNAL: Return the source key fields.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField>
getSourceKeysToTargetForeignKeys()
INTERNAL: Return the source/target key fields.Vector
getTargetForeignKeyFieldNames()
INTERNAL: Return the target foreign key field names associated with the mapping.Vector<org.eclipse.persistence.internal.helper.DatabaseField>
getTargetForeignKeyFields()
INTERNAL: Return the target foreign key fields.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField>
getTargetForeignKeysToSourceKeys()
INTERNAL: Return the target/source key fields.Map
getTargetForeignKeyToSourceKeys()
INTERNAL: Maintain for backward compatibility.List<org.eclipse.persistence.internal.helper.DatabaseField>
getTargetPrimaryKeyFields()
INTERNAL: Primary keys of targetForeignKeyTable.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.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:void
performDataModificationEvent(Object[] event, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Perform the commit event.void
postInitializeSourceAndTargetExpressions()
INTERNAL: Post-initialize source and target expression fields created when a mapping's selectionCriteria is created early with only partly initialized fields.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.boolean
requiresDataModificationEvents()
INTERNAL: Returns whether this mapping uses data modification events to complete its writesvoid
setAddTargetSQLString(String sqlString)
PUBLIC:void
setCustomAddTargetQuery(DataModifyQuery query)
PUBLIC: The default add target query for mapping can be overridden by specifying the new query.void
setCustomRemoveAllTargetsQuery(DataModifyQuery query)
PUBLIC: The default remove all targets query for mapping can be overridden by specifying the new query.void
setCustomRemoveTargetQuery(DataModifyQuery query)
PUBLIC: The default remove target query for mapping can be overridden by specifying the new query.void
setDeleteAllSQLString(String sqlString)
PUBLIC: Set the SQL string used by the mapping to delete the target objects.void
setSessionName(String name)
PUBLIC: Set the name of the session to execute the mapping's queries under.void
setSourceKeyFieldNames(Vector fieldNames)
INTERNAL: Set the source key field names associated with the mapping.void
setSourceKeyFields(Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceKeyFields)
INTERNAL: Set the source key fields.void
setTargetForeignKeyFieldName(String targetForeignKeyFieldName)
PUBLIC: Define the target foreign key relationship in the one-to-many mapping.void
setTargetForeignKeyFieldNames(String[] targetForeignKeyFieldNames, String[] sourceKeyFieldNames)
PUBLIC: Define the target foreign key relationship in the one-to-many mapping.void
setTargetForeignKeyFieldNames(Vector fieldNames)
INTERNAL: Set the target key field names associated with the mapping.void
setTargetForeignKeyFields(Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeyFields)
INTERNAL: Set the target fields.void
updateTargetForeignKeyPostUpdateSource_ObjectAdded(ObjectLevelModifyQuery query, Object objectAdded, Map extraData)
INTERNAL: Update target foreign key after a target object was added to the source.void
updateTargetForeignKeyPostUpdateSource_ObjectRemoved(ObjectLevelModifyQuery query, Object objectRemoved)
INTERNAL: Update target foreign key after a target object was removed from the source.void
updateTargetRowPostInsertSource(WriteObjectQuery query)
INTERNAL: Update target foreign keys after a new source was inserted.void
updateTargetRowPreDeleteSource(ObjectLevelModifyQuery query)
INTERNAL: Update target foreign key after a target object was removed from the source.boolean
verifyDelete(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, buildBackupCloneForPartObject, buildChangeRecord, buildCloneForPartObject, buildContainerClone, buildCopy, buildElementClone, buildElementUnitOfWorkClone, buildExpression, buildReferencesPKList, calculateDeferredChanges, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadePerformRemoveIfRequired, cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired, cascadeRegisterNewIfRequired, compareCollectionsForChange, compareForChange, compareObjects, convertClassNamesToClasses, extractResultFromBatchQuery, fixRealObjectReferences, getContainerPolicy, getJoinCriteria, getListOrderField, getObjectCorrespondingTo, getOrderByQueryKeyExpressions, getOrderCorrectionType, getRealCollectionAttributeValueFromObject, hasOrderBy, isAttributeValueInstantiatedOrChanged, isChangeTrackingSupported, isCollectionMapping, isListOrderFieldSupported, isMapKeyObjectRelationship, iterateOnElement, iterateOnRealAttributeValue, load, loadAll, mergeChangesIntoObject, mergeIntoObject, mustDeleteReferenceObjectsOneByOne, postCalculateChanges, postDelete, postInitialize, preInsert, preUpdate, recordPrivateOwnedRemovals, replaceValueHoldersIn, setChangeListener, setContainerPolicy, setCustomDeleteAllQuery, setDeleteAllCall, setListOrderField, setListOrderFieldName, setMustDeleteReferenceObjectsOneByOne, setOrderCorrectionType, setUseLazyInstantiationForIndirectCollection, shouldUseLazyInstantiationForIndirectCollection, shouldUseListOrderFieldTableExpression, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, updateChangeRecord, updateChangeRecordForSelfMerge, updateCollectionChangeRecord, useCollectionClass, useCollectionClassName, useListClassName, useMapClass, useMapClass, useMapClassName, useSortedSetClass, useSortedSetClassName, useSortedSetClassName, useTransparentCollection, useTransparentList, useTransparentMap, useTransparentSet, validateBeforeInitialization, valueFromPKList, writeChanges
-
Methods inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping
addForeignKeyField, buildBackupClone, buildClone, buildCloneFromRow, createCloneValueHolder, dontUseBatchReading, dontUseIndirection, extendPessimisticLockScopeInSourceQuery, fixObjectReferences, getAttributeValueFromObject, getAttributeValueWithClonedValueHolders, getBatchFetchType, getIndirectionPolicy, getJoinFetch, getMappedBy, getOrderByNormalizedExpressions, getPartitioningPolicy, getPartitioningPolicyName, getRealAttributeValueFromAttribute, getReferenceClass, getReferenceClassName, getReferenceDescriptor, getRelationshipPartner, getRelationshipPartnerAttributeName, getSelectionCriteria, getSelectionQuery, getValueFromRemoteValueHolder, hasCustomSelectionQuery, hasDependency, hasNestedIdentityReference, instantiateAttribute, isAttributeValueFromObjectInstantiated, isAttributeValueFullyBuilt, isAttributeValueInstantiated, isCascadeDetach, isCascadeMerge, isCascadeOnDeleteSetOnDatabase, isCascadePersist, isCascadeRefresh, isCascadeRemove, isForeignReferenceMapping, isInnerJoinFetched, isJoinFetched, isLazy, isLockableMapping, isOuterJoinFetched, isPrivateOwned, iterate, mergeRemoteValueHolder, preInitialize, prepareNestedBatchQuery, prepareNestedJoins, privateOwnedRelationship, readFromRowIntoObject, remoteInitialization, requiresTransientWeavedFields, setBatchFetchType, setCascadeAll, setCascadeDetach, setCascadeMerge, setCascadePersist, setCascadeRefresh, setCascadeRemove, setCustomSelectionQuery, setForceInitializationOfSelectionCriteria, setIndirectionPolicy, setIsCacheable, setIsCascadeOnDeleteSetOnDatabase, setIsPrivateOwned, setJoinFetch, setMappedBy, setPartitioningPolicy, setPartitioningPolicyName, setRealAttributeValueInObject, setReferenceClass, setReferenceClassName, setRelationshipPartner, setRelationshipPartnerAttributeName, setRequiresTransientWeavedFields, setSelectionCall, setSelectionCriteria, setSelectionSQLString, setShouldExtendPessimisticLockScope, setUsesBatchReading, setUsesIndirection, shouldExtendPessimisticLockScope, shouldExtendPessimisticLockScopeInDedicatedQuery, shouldExtendPessimisticLockScopeInSourceQuery, shouldExtendPessimisticLockScopeInTargetQuery, shouldMergeCascadeParts, shouldRefreshCascadeParts, shouldUseBatchReading, trimRowForJoin, trimRowForJoin, useBasicIndirection, useBatchReading, useContainerIndirection, useInnerJoinFetch, useOuterJoinFetch, usesIndirection, useWeavedIndirection, valueFromRow
-
Methods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
addUnconvertedProperty, buildObjectJoinExpression, buildObjectJoinExpression, buildShallowOriginalFromRow, derivesId, earlyPreDelete, getAttributeAccessor, getAttributeClassification, getAttributeName, getDerivedIdMapping, getDescriptor, getField, getFieldClassification, getFields, getGetMethodName, getMapsIdValue, getProperties, getProperty, getRealAttributeValueFromObject, getSelectFields, getSelectTables, getSetMethodName, getUnconvertedProperties, getWeight, hasConstraintDependency, hasMapsIdValue, hasUnconvertedProperties, isAbstractColumnMapping, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isCacheable, isCandidateForPrivateOwnedRemoval, isCloningRequired, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isElementCollectionMapping, isInAndOutSopObject, isInOnlySopObject, isInSopObject, isJPAId, isManyToManyMapping, isManyToOneMapping, isMapKeyMapping, isMultitenantPrimaryKeyMapping, isNestedTableMapping, isObjectReferenceMapping, isOneToOneMapping, isOptional, isOutOnlySopObject, isOutSopObject, isOwned, isPrimaryKeyMapping, isReadOnly, isReferenceMapping, isStructureMapping, isTransformationMapping, isUnidirectionalOneToManyMapping, isUsingMethodAccess, isVariableOneToOneMapping, isWriteOnly, isXMLMapping, postCalculateChangesOnDeleted, readFromResultSetIntoObject, readOnly, readWrite, rehashFieldDependancies, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setDerivedIdMapping, setDerivesId, setDescriptor, setGetMethodName, setIsInAndOutSopObject, setIsInSopObject, setIsJPAId, setIsLazy, setIsMapKeyMapping, setIsOptional, setIsOutSopObject, setIsPrimaryKeyMapping, setIsReadOnly, setMapsIdValue, setProperties, setProperty, setSetMethodName, setWeight, toString, validateAfterInitialization, valueFromObject, valueFromResultSet, valueFromRow, writeFromAttributeIntoRow, writeFromObjectIntoRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdate, writeFromObjectIntoRowForUpdateAfterShallowInsert, writeFromObjectIntoRowForUpdateBeforeShallowDelete, writeFromObjectIntoRowForWhereClause, writeFromObjectIntoRowWithChangeRecord, writeInsertFieldsIntoRow, writeUpdateFieldsIntoRow
-
-
-
-
Method Detail
-
isRelationalMapping
public boolean isRelationalMapping()
INTERNAL:- Overrides:
isRelationalMapping
in classDatabaseMapping
-
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.- Overrides:
addTargetForeignKeyField
in classForeignReferenceMapping
-
addTargetForeignKeyFieldName
public void addTargetForeignKeyFieldName(String targetForeignKeyFieldName, 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:- use a DirectToFieldMapping and maintain the foreign key fields directly in the target
- use a ManyToManyMapping
- use an AggregateCollectionMapping
-
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 amendment method that would amend 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.
-
collectQueryParameters
public void collectQueryParameters(Set<org.eclipse.persistence.internal.helper.DatabaseField> cacheFields)
INTERNAL: This method is used to store the FK fields that can be cached that correspond to noncacheable mappings the FK field values will be used to re-issue the query when cloning the shared cache entity- Overrides:
collectQueryParameters
in classCollectionMapping
-
clone
public Object clone()
INTERNAL: Clone the appropriate attributes.- Specified by:
clone
in interfaceMapComponentMapping
- Overrides:
clone
in classCollectionMapping
-
createMapComponentFromRow
public Object createMapComponentFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord dbRow, ObjectBuildingQuery query, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, org.eclipse.persistence.internal.sessions.AbstractSession session, boolean isTargetProtected)
INTERNAL Called when a DatabaseMapping is used to map the key in a collection. Returns the key.- Specified by:
createMapComponentFromRow
in interfaceMapComponentMapping
-
getFieldsForTranslationInAggregate
public Collection getFieldsForTranslationInAggregate()
INTERNAL: Return source key fields for translation by an AggregateObjectMapping- Overrides:
getFieldsForTranslationInAggregate
in classForeignReferenceMapping
-
getSourceKeyFieldNames
public Vector getSourceKeyFieldNames()
PUBLIC: Return the source key field names associated with the mapping. These are in-order with the targetForeignKeyFieldNames.
-
getSourceKeyFields
public Vector<org.eclipse.persistence.internal.helper.DatabaseField> getSourceKeyFields()
INTERNAL: Return the source key fields.
-
getSourceKeysToTargetForeignKeys
public Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getSourceKeysToTargetForeignKeys()
INTERNAL: Return the source/target key fields.
-
getTargetPrimaryKeyFields
public List<org.eclipse.persistence.internal.helper.DatabaseField> getTargetPrimaryKeyFields()
INTERNAL: Primary keys of targetForeignKeyTable.- Overrides:
getTargetPrimaryKeyFields
in classCollectionMapping
-
getTargetForeignKeyFieldNames
public Vector getTargetForeignKeyFieldNames()
INTERNAL: Return the target foreign key field names associated with the mapping. These are in-order with the targetForeignKeyFieldNames.
-
getTargetForeignKeyFields
public Vector<org.eclipse.persistence.internal.helper.DatabaseField> getTargetForeignKeyFields()
INTERNAL: Return the target foreign key fields.
-
getTargetForeignKeysToSourceKeys
public Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getTargetForeignKeysToSourceKeys()
INTERNAL: Return the target/source key fields.
-
getTargetForeignKeyToSourceKeys
public 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 classDatabaseMapping
-
initialize
public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
INTERNAL: Initialize the mapping.- Overrides:
initialize
in classCollectionMapping
- Throws:
DescriptorException
-
isOneToManyMapping
public boolean isOneToManyMapping()
INTERNAL:- Overrides:
isOneToManyMapping
in classDatabaseMapping
-
performDataModificationEvent
public void performDataModificationEvent(Object[] event, org.eclipse.persistence.internal.sessions.AbstractSession session) throws DatabaseException, DescriptorException
INTERNAL: Perform the commit event. This is used in the uow to delay data modifications.- Overrides:
performDataModificationEvent
in classDatabaseMapping
- Throws:
DatabaseException
DescriptorException
-
postInsert
public void postInsert(WriteObjectQuery query) throws DatabaseException, OptimisticLockException
INTERNAL: Insert the reference objects.- Overrides:
postInsert
in classCollectionMapping
- Throws:
DatabaseException
OptimisticLockException
-
postInitializeSourceAndTargetExpressions
public void postInitializeSourceAndTargetExpressions()
INTERNAL: Post-initialize source and target expression fields created when a mapping's selectionCriteria is created early with only partly initialized fields.
-
postUpdate
public void postUpdate(WriteObjectQuery query) throws DatabaseException, OptimisticLockException
INTERNAL: Update the reference objects.- Overrides:
postUpdate
in classDatabaseMapping
- Throws:
DatabaseException
OptimisticLockException
-
preDelete
public void preDelete(DeleteObjectQuery query) throws DatabaseException, OptimisticLockException
INTERNAL: Delete the reference objects.- Overrides:
preDelete
in classDatabaseMapping
- Throws:
DatabaseException
OptimisticLockException
-
prepareCascadeLockingPolicy
public void prepareCascadeLockingPolicy()
Prepare a cascade locking policy.- Overrides:
prepareCascadeLockingPolicy
in classDatabaseMapping
-
requiresDataModificationEvents
public boolean requiresDataModificationEvents()
INTERNAL: Returns whether this mapping uses data modification events to complete its writes- See Also:
UnidirectionalOneToManyMapping
-
setCustomAddTargetQuery
public void setCustomAddTargetQuery(DataModifyQuery query)
PUBLIC: The default add target query for mapping can be overridden by specifying the new query. This query must set new value to target foreign key.
-
setAddTargetSQLString
public void setAddTargetSQLString(String sqlString)
PUBLIC:
-
setCustomRemoveTargetQuery
public void setCustomRemoveTargetQuery(DataModifyQuery query)
PUBLIC: The default remove target query for mapping can be overridden by specifying the new query. In case target foreign key references the source, this query must set target foreign key to null.
-
setCustomRemoveAllTargetsQuery
public void setCustomRemoveAllTargetsQuery(DataModifyQuery query)
PUBLIC: The default remove all targets query for mapping can be overridden by specifying the new query. This query must set all target foreign keys that reference the source to null.
-
setDeleteAllSQLString
public void setDeleteAllSQLString(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 classCollectionMapping
-
setSessionName
public void setSessionName(String name)
PUBLIC: Set the name of the session to execute the mapping's queries under. This can be used by the session broker to override the default session to be used for the target class.- Overrides:
setSessionName
in classCollectionMapping
-
setSourceKeyFieldNames
public void setSourceKeyFieldNames(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(Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceKeyFields)
INTERNAL: Set the source key fields.
-
setTargetForeignKeyFieldName
public void setTargetForeignKeyFieldName(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:- use a DirectToFieldMapping and maintain the foreign key fields directly in the target
- use a ManyToManyMapping
- use an AggregateCollectionMapping
-
setTargetForeignKeyFieldNames
public void setTargetForeignKeyFieldNames(String[] targetForeignKeyFieldNames, 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(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(Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeyFields)
INTERNAL: Set the target fields.
-
isCascadedLockingSupported
public boolean isCascadedLockingSupported()
INTERNAL Return true if this mapping supports cascaded version optimistic locking.- Overrides:
isCascadedLockingSupported
in classDatabaseMapping
-
isJoiningSupported
public boolean isJoiningSupported()
INTERNAL: Return if this mapping support joining.- Overrides:
isJoiningSupported
in classForeignReferenceMapping
-
updateTargetRowPostInsertSource
public void updateTargetRowPostInsertSource(WriteObjectQuery query) throws DatabaseException
INTERNAL: Update target foreign keys after a new source was inserted. This follows following steps.- Throws:
DatabaseException
-
updateTargetForeignKeyPostUpdateSource_ObjectAdded
public void updateTargetForeignKeyPostUpdateSource_ObjectAdded(ObjectLevelModifyQuery query, Object objectAdded, Map extraData) throws DatabaseException
INTERNAL: Update target foreign key after a target object was added to the source. This follows following steps.- Extract primary key and its value from the source object.
- Extract target key and its value from the target object.
- Construct an update statement with above fields and values for target table.
- execute the statement.
- Throws:
DatabaseException
-
updateTargetForeignKeyPostUpdateSource_ObjectRemoved
public void updateTargetForeignKeyPostUpdateSource_ObjectRemoved(ObjectLevelModifyQuery query, Object objectRemoved) throws DatabaseException
INTERNAL: Update target foreign key after a target object was removed from the source. This follows following steps.- Extract primary key and its value from the source object.
- Extract target key and its value from the target object.
- Construct an update statement with above fields and values for target table.
- execute the statement.
- Throws:
DatabaseException
-
updateTargetRowPreDeleteSource
public void updateTargetRowPreDeleteSource(ObjectLevelModifyQuery query) throws DatabaseException
INTERNAL: Update target foreign key after a target object was removed from the source. This follows following steps.- Extract primary key and its value from the source object.
- Extract target key and its value from the target object.
- Construct an update statement with above fields and values for target table.
- execute the statement.
- Throws:
DatabaseException
-
verifyDelete
public boolean verifyDelete(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 classCollectionMapping
- Throws:
DatabaseException
-
-