Top Description Fields Constructors Methods
org.eclipse.persistence.mappings

public abstract Class ObjectReferenceMapping

extends ForeignReferenceMapping
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.mappings.OneToOneMapping, org.eclipse.persistence.mappings.VariableOneToOneMapping, org.eclipse.persistence.mappings.structures.ReferenceMapping, org.eclipse.persistence.eis.mappings.EISOneToOneMapping
Imports
java.util.Collection, .HashSet, .Map, .Set, .Vector, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.descriptors.changetracking.ChangeTracker, org.eclipse.persistence.exceptions.DatabaseException, .DescriptorException, .OptimisticLockException, org.eclipse.persistence.expressions.Expression, org.eclipse.persistence.indirection.ValueHolder, .ValueHolderInterface, org.eclipse.persistence.internal.descriptors.DescriptorIterator, .ObjectBuilder, org.eclipse.persistence.internal.descriptors.changetracking.ObjectChangeListener, org.eclipse.persistence.internal.helper.DatabaseField, .IdentityHashSet, org.eclipse.persistence.internal.identitymaps.CacheKey, org.eclipse.persistence.internal.indirection.DatabaseValueHolder, .ProxyIndirectionPolicy, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, .ChangeRecord, .MergeManager, .ObjectChangeSet, .ObjectReferenceChangeRecord, .UnitOfWorkChangeSet, .UnitOfWorkImpl, org.eclipse.persistence.internal.sessions.remote.ObjectDescriptor, org.eclipse.persistence.queries.DeleteObjectQuery, .InsertObjectQuery, .ObjectBuildingQuery, .ObjectLevelModifyQuery, .ObjectLevelReadQuery, .QueryByExamplePolicy, .ReadObjectQuery, .WriteObjectQuery, org.eclipse.persistence.sessions.CopyGroup, .Project, org.eclipse.persistence.sessions.remote.DistributedSession

Purpose: Abstract class for 1:1, variable 1:1 and reference mappings

Field Summary

Modifier and TypeField and Description
protected Vector<DatabaseField>
foreignKeyFields

Keeps track of which fields are foreign keys on a per field basis (can have mixed foreign key relationships).

protected boolean
isForeignKeyRelationship

Keeps track if any of the fields are foreign keys.

Inherited from org.eclipse.persistence.mappings.ForeignReferenceMapping:
batchFetchTypecascadeDetachcascadeMergecascadePersistcascadeRefreshcascadeRemoveextendPessimisticLockScopeforceInitializationOfSelectionCriteriahasCustomSelectionQueryindirectionPolicyINNER_JOINisCascadeOnDeleteSetOnDatabaseisPrivateOwnedjoinFetchmappedByNONEOUTER_JOINpartitioningPolicypartitioningPolicyNameQUERY_BATCH_PARAMETERreferenceClassreferenceClassNamereferenceDescriptorrelationshipPartnerrelationshipPartnerAttributeNamerequiresTransientWeavedFieldsselectionQuerytempInitSession

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public Object
buildBackupCloneForPartObject(Object
TODO
attributeValue
,
Object
TODO
clone
,
Object
TODO
backup
,
UnitOfWorkImpl
TODO
unitOfWork
)

Implements abstract org.eclipse.persistence.mappings.ForeignReferenceMapping.buildBackupCloneForPartObject.

INTERNAL: Used during building the backup shallow copy to copy the vector without re-registering the target objects.
public ChangeRecord
buildChangeRecord(Object clone, ObjectChangeSet owner, AbstractSession session)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.buildChangeRecord.

INTERNAL: Directly build a change record without comparison
public Object
buildCloneForPartObject(Object
TODO
attributeValue
,
Object
TODO
original
,
CacheKey
TODO
cacheKey
,
Object
TODO
clone
,
AbstractSession
TODO
cloningSession
,
Integer
TODO
refreshCascade
,
boolean
TODO
isExisting
,
boolean
TODO
isFromSharedCache
)

Implements abstract org.eclipse.persistence.mappings.ForeignReferenceMapping.buildCloneForPartObject.

INTERNAL: Require for cloning, the part must be cloned.
public void
buildCopy(Object
TODO
copy
,
Object
TODO
original
,
CopyGroup
TODO
group
)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.buildCopy.

INTERNAL: Copy of the attribute of the object.
public Expression
buildExpression(Object
TODO
queryObject
,
QueryByExamplePolicy
TODO
policy
,
Expression
TODO
expressionBuilder
,
Map<K, V>
TODO
processedObjects
,
AbstractSession
TODO
session
)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.buildExpression.

INTERNAL: In case Query By Example is used, this method generates an expression from a attribute value pair.
public Object[]
buildReferencesPKList(Object entity, Object attribute, AbstractSession session)

Implements abstract org.eclipse.persistence.mappings.ForeignReferenceMapping.buildReferencesPKList.

INTERNAL: This method will access the target relationship and create a list of PKs of the target entities.
public Collection<E>
buildTargetInterfaces(Class<?> aClass, Collection<E> targetInterfacesCol)

INTERNAL: Build a list of all the interfaces and super interfaces for a given class.

public Object
buildUnitofWorkCloneForPartObject(Object attributeValue, Object original, Object clone, Integer refreshCascade, UnitOfWorkImpl unitOfWork, boolean isExisting)

INTERNAL: Require for cloning, the part must be cloned.

public void
cascadeDiscoverAndPersistUnregisteredNewObjects(Object
TODO
object
,
Map<K, V>
TODO
newObjects
,
Map<K, V>
TODO
unregisteredExistingObjects
,
Map<K, V>
TODO
visitedObjects
,
UnitOfWorkImpl
TODO
uow
,
Set<E>
TODO
cascadeErrors
)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.cascadeDiscoverAndPersistUnregisteredNewObjects.

INTERNAL: Cascade discover and persist new objects during commit.
public void
cascadeDiscoverAndPersistUnregisteredNewObjects(Object object, Map<K, V> newObjects, Map<K, V> unregisteredExistingObjects, Map<K, V> visitedObjects, UnitOfWorkImpl uow, boolean getAttributeValueFromObject, Set<E> cascadeErrors)

INTERNAL: Cascade discover and persist new objects during commit.

public void
cascadePerformRemoveIfRequired(Object
TODO
object
,
UnitOfWorkImpl
TODO
uow
,
Map<K, V>
TODO
visitedObjects
)

Implements abstract org.eclipse.persistence.mappings.DatabaseMapping.cascadePerformRemoveIfRequired.

INTERNAL: Cascade registerNew for Create through mappings that require the cascade
public void
cascadePerformRemoveIfRequired(Object
is either the source object, or attribute value if getAttributeValueFromObject is true.
object
,
UnitOfWorkImpl uow, Map<K, V> visitedObjects, boolean getAttributeValueFromObject)

INTERNAL: Cascade remove through mappings that require the cascade.

public void
cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired(Object
TODO
object
,
UnitOfWorkImpl
TODO
uow
,
Map<K, V>
TODO
visitedObjects
)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired.

INTERNAL: Cascade removal of orphaned private owned objects from the UnitOfWorkChangeSet
public void
cascadeRegisterNewIfRequired(Object
TODO
object
,
UnitOfWorkImpl
TODO
uow
,
Map<K, V>
TODO
visitedObjects
)

Implements abstract org.eclipse.persistence.mappings.DatabaseMapping.cascadeRegisterNewIfRequired.

INTERNAL: Cascade registerNew for Create through mappings that require the cascade
public void
cascadeRegisterNewIfRequired(Object
is either the source object, or attribute value if getAttributeValueFromObject is true.
object
,
UnitOfWorkImpl uow, Map<K, V> visitedObjects, boolean getAttributeValueFromObject)

INTERNAL: Cascade registerNew for Create through mappings that require the cascade

protected Vector<DatabaseField>
collectFields()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.collectFields.

INTERNAL: Return all the fields populated by this mapping, these are foreign keys only.
public void
collectQueryParameters(Set<DatabaseField>
TODO
cacheFields
)

Implements abstract org.eclipse.persistence.mappings.ForeignReferenceMapping.collectQueryParameters.

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
public ChangeRecord
compareForChange(Object
TODO
clone
,
Object
TODO
backUp
,
ObjectChangeSet
TODO
owner
,
AbstractSession
TODO
session
)

Implements abstract org.eclipse.persistence.mappings.DatabaseMapping.compareForChange.

INTERNAL: Return an ObjectReferenceChangeRecord describing the change, or null if no change.
protected boolean
compareObjectsWithoutPrivateOwned(Object firstObject, Object secondObject, AbstractSession session)

Implements abstract org.eclipse.persistence.mappings.ForeignReferenceMapping.compareObjectsWithoutPrivateOwned.

INTERNAL: Compare the references of the two objects are the same, not the objects themselves.
protected boolean
compareObjectsWithPrivateOwned(Object firstObject, Object secondObject, AbstractSession session)

Implements abstract org.eclipse.persistence.mappings.ForeignReferenceMapping.compareObjectsWithPrivateOwned.

INTERNAL: Compare the references of the two objects are the same, and the objects themselves are the same.
public <T> DatabaseValueHolder<T>
createCloneValueHolder(ValueHolderInterface<T>
TODO
attributeValue
,
Object
TODO
original
,
Object
TODO
clone
,
AbstractRecord
TODO
row
,
AbstractSession
TODO
cloningSession
,
boolean
indicates that we are building the clone directly from a row as opposed to building the original from the row, putting it in the shared cache, and then cloning the original.
buildDirectlyFromRow
)

Overrides org.eclipse.persistence.mappings.ForeignReferenceMapping.createCloneValueHolder.

INTERNAL: Builder the unit of work value holder.
public void
earlyPreDelete(DeleteObjectQuery
TODO
query
,
Object
TODO
object
)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.earlyPreDelete.

INTERNAL: Record deletion dependencies for foreign key constraints.
public AbstractRecord
extractPrimaryKeyRowForSourceObject(Object domainObject, AbstractSession session)

INTERNAL: Extract the reference pk for rvh usage in remote model.

public Object
extractPrimaryKeysForReferenceObject(Object domainObject, AbstractSession session)

INTERNAL: Extract the reference pk for rvh usage in remote model.

public Object
extractPrimaryKeysForReferenceObjectFromRow(AbstractRecord row)

INTERNAL: Return the primary key for the reference object (i.e. the object object referenced by domainObject and specified by mapping).

public Object
extractPrimaryKeysFromRealReferenceObject(Object object, AbstractSession session)

INTERNAL: Extract the reference pk for rvh usage in remote model.

public void
fixRealObjectReferences(Object
TODO
object
,
Map<Object, ObjectDescriptor>
TODO
objectDescriptors
,
Map<Object, Object>
TODO
processedObjects
,
ObjectLevelReadQuery
TODO
query
,
DistributedSession
TODO
session
)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.fixRealObjectReferences.

INTERNAL: We are not using a remote valueholder so we need to replace the reference object(s) with the corresponding object(s) from the remote session.
public ClassDescriptor
getDescriptorForTarget(Object object, AbstractSession session)

INTERNAL: Return a descriptor for the target of this mapping

public Vector<DatabaseField>
getForeignKeyFields()

INTERNAL: Returns the foreign key names associated with the mapping.

protected Object
getPrimaryKeyForObject(Object object, AbstractSession session)

INTERNAL:

public Object
getRealAttributeValueFromAttribute(Object attributeValue, Object object, AbstractSession session)

Overrides org.eclipse.persistence.mappings.ForeignReferenceMapping.getRealAttributeValueFromAttribute.

INTERNAL: Object reference must unwrap the reference object if required.
public boolean
hasConstraintDependency()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.hasConstraintDependency.

INTERNAL: The returns if the mapping has any constraint dependencies, such as foreign keys and join tables.
public boolean
hasRelationTableMechanism()

PUBLIC: Indicates whether the mapping has RelationTableMechanism.

protected void
insert(WriteObjectQuery query)

INTERNAL: Insert privately owned parts

public ObjectReferenceChangeRecord
internalBuildChangeRecord(Object newValue, ObjectChangeSet owner, AbstractSession session)

INTERNAL: Directly build a change record based on the newValue without comparison

public boolean
isChangeTrackingSupported(Project project)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.isChangeTrackingSupported.

INTERNAL: Return if this mapping supports change tracking.
public boolean
isForeignKeyRelationship()

INTERNAL: Return if the 1-1 mapping has a foreign key dependency to its target.

public boolean
isObjectReferenceMapping()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.isObjectReferenceMapping.

INTERNAL: Related mapping should implement this method to return true.
public void
iterateOnRealAttributeValue(DescriptorIterator iterator, Object realAttributeValue)

Implements abstract org.eclipse.persistence.mappings.ForeignReferenceMapping.iterateOnRealAttributeValue.

INTERNAL: Iterate on the attribute value.
public void
loadAll(Object object, AbstractSession session, IdentityHashSet loaded)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.loadAll.

Force instantiation of all indirections.
public void
mergeChangesIntoObject(Object target, ChangeRecord changeRecord, Object source, MergeManager mergeManager, AbstractSession targetSession)

Implements abstract org.eclipse.persistence.mappings.DatabaseMapping.mergeChangesIntoObject.

INTERNAL: Merge changes from the source to the target object.
public void
mergeIntoObject(Object target, boolean isTargetUnInitialized, Object source, MergeManager mergeManager, AbstractSession targetSession)

Implements abstract org.eclipse.persistence.mappings.DatabaseMapping.mergeIntoObject.

INTERNAL: Merge changes from the source to the target object.
public void
postCalculateChanges(ChangeRecord changeRecord, UnitOfWorkImpl uow)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.postCalculateChanges.

INTERNAL: Overridden by mappings that require additional processing of the change record after the record has been calculated.
public void
postDelete(DeleteObjectQuery query)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.postDelete.

INTERNAL: Delete privately owned parts
public void
postInsert(WriteObjectQuery query)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.postInsert.

INTERNAL: Insert privately owned parts
public void
postUpdate(WriteObjectQuery query)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.postUpdate.

INTERNAL: Update privately owned parts
public void
preDelete(DeleteObjectQuery query)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.preDelete.

INTERNAL: Delete privately owned parts
public void
public void
preInsert(WriteObjectQuery query)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.preInsert.

INTERNAL: Insert privately owned parts
public void
preUpdate(WriteObjectQuery query)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.preUpdate.

INTERNAL: Update privately owned parts
protected Object
readPrivateOwnedForObject(ObjectLevelModifyQuery modifyQuery)

INTERNAL: Reads the private owned object.

public void
recordPrivateOwnedRemovals(Object object, UnitOfWorkImpl uow)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.recordPrivateOwnedRemovals.

INTERNAL: Overridden by mappings that require additional processing of the change record after the record has been calculated.
protected void
setForeignKeyFields(Vector<DatabaseField> foreignKeyFields)

INTERNAL: Set the foreign key fields associated with the mapping.

public void
setIsForeignKeyRelationship(boolean isForeignKeyRelationship)

INTERNAL: Set if the 1-1 mapping has a foreign key dependency to its target.

public void
setNewValueInChangeRecord(Object newValue, ObjectReferenceChangeRecord changeRecord, ObjectChangeSet owner, AbstractSession session)

INTERNAL: Set the newValue in the change record

protected void
update(WriteObjectQuery query)

INTERNAL: Update the private owned part.

public void
updateChangeRecord(Object clone, Object newValue, Object oldValue, ObjectChangeSet objectChangeSet, UnitOfWorkImpl uow)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.updateChangeRecord.

INTERNAL: Either create a new change record or update the change record with the new value.
public void
updateChangeRecordForSelfMerge(ChangeRecord changeRecord, Object source, Object target, UnitOfWorkChangeSet parentUOWChangeSet, UnitOfWorkImpl unitOfWork)

Implements abstract org.eclipse.persistence.mappings.ForeignReferenceMapping.updateChangeRecordForSelfMerge.

INTERNAL: Update a ChangeRecord to replace the ChangeSet for the old entity with the changeSet for the new Entity.
public void
useProxyIndirection()

PUBLIC: Set this mapping to use Proxy Indirection.

public void
useProxyIndirection(Class<?>[]
The interfaces that the target class implements. The attribute must be typed as one of these interfaces.
targetInterfaces
)

PUBLIC: Set this mapping to use Proxy Indirection.

public void
useProxyIndirection(Class<?>
The interface that the target class implements. The attribute must be typed as this interface.
targetInterface
)

PUBLIC: Set this mapping to use Proxy Indirection.

public Object
valueFromPKList(Object[] pks, AbstractRecord foreignKeys, AbstractSession session)

Implements abstract org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromPKList.

INTERNAL: This method is used to load a relationship from a list of PKs.
public boolean
verifyDelete(Object object, AbstractSession session)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.verifyDelete.

INTERNAL: To verify if the specified object is deleted or not.
public void
writeFromObjectIntoRowForUpdate(WriteObjectQuery query, AbstractRecord databaseRow)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowForUpdate.

INTERNAL: Get a value from the object and set that in the respective field of the row.
public void
writeFromObjectIntoRowForWhereClause(ObjectLevelModifyQuery query, AbstractRecord databaseRow)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowForWhereClause.

INTERNAL: Get a value from the object and set that in the respective field of the row.
Inherited from org.eclipse.persistence.mappings.ForeignReferenceMapping:
addForeignKeyFieldaddTargetForeignKeyFieldbatchedValueFromRowbuildBackupClonebuildBatchCriteriabuildClonebuildCloneFromRowcheckCacheForBatchKeyclonecompareObjectsconvertClassNamesToClassesdontDoMergedontUseBatchReadingdontUseIndirectionexecuteBatchQueryextendPessimisticLockScopeInSourceQueryextendPessimisticLockScopeInTargetQueryextractBatchKeyFromRowextractResultFromBatchQueryfixObjectReferencesgetAttributeValueFromObjectgetAttributeValueWithClonedValueHoldersgetBatchFetchTypegetExtendPessimisticLockScopeDedicatedQuerygetFieldsForTranslationInAggregategetIndirectionPolicygetJoinCriteriagetJoinFetchgetMappedBygetObjectCorrespondingTogetOrderByNormalizedExpressionsgetPartitioningPolicygetPartitioningPolicyNamegetReferenceClassgetReferenceClassNamegetReferenceDescriptorgetRelationshipPartnergetRelationshipPartnerAttributeNamegetSelectionCriteriagetSelectionQuerygetTempSessiongetValueFromRemoteValueHolderhasCustomSelectionQueryhasDependencyhasNestedIdentityReferenceinitializeinitializeReferenceDescriptorinitializeSelectionQueryinstantiateAttributeisAttributeValueFromObjectInstantiatedisAttributeValueFullyBuiltisAttributeValueInstantiatedisCascadeDetachisCascadeMergeisCascadeOnDeleteSetOnDatabaseisCascadePersistisCascadeRefreshisCascadeRemoveisExtendingPessimisticLockScopeisForeignReferenceMappingisInnerJoinFetchedisJoinFetchedisJoiningSupportedisLazyisLockableMappingisOuterJoinFetchedisPrivateOwnediterateloadmergeRemoteValueHolderpostPrepareNestedBatchQueryprepareHistoricalQueryprepareNestedBatchQueryprepareNestedJoinQueryCloneprepareNestedJoinsprivateOwnedRelationshipreadFromRowIntoObjectremoteInitializationreplaceValueHoldersInrequiresTransientWeavedFieldssetBatchFetchTypesetCascadeAllsetCascadeDetachsetCascadeMergesetCascadePersistsetCascadeRefreshsetCascadeRemovesetCustomSelectionQuerysetForceInitializationOfSelectionCriteriasetHasCustomSelectionQuerysetIndirectionPolicysetIsCacheablesetIsCascadeOnDeleteSetOnDatabasesetIsPrivateOwnedsetJoinFetchsetMappedBysetPartitioningPolicysetPartitioningPolicyNamesetRealAttributeValueInObjectsetReferenceClasssetReferenceClassNamesetReferenceDescriptorsetRelationshipPartnersetRelationshipPartnerAttributeNamesetRequiresTransientWeavedFieldssetSelectionCallsetSelectionCriteriasetSelectionQuerysetSelectionSQLStringsetShouldExtendPessimisticLockScopesetTempSessionsetUsesBatchReadingsetUsesIndirectionshouldExtendPessimisticLockScopeshouldExtendPessimisticLockScopeInDedicatedQueryshouldExtendPessimisticLockScopeInSourceQueryshouldExtendPessimisticLockScopeInTargetQueryshouldForceInitializationOfSelectionCriteriashouldInitializeSelectionCriteriashouldMergeCascadePartsshouldMergeCascadeReferenceshouldObjectModifyCascadeToPartsshouldRefreshCascadePartsshouldUseBatchReadingshouldUseValueFromRowWithJointrimRowForJointrimRowForJoinuseBasicIndirectionuseBatchReadinguseContainerIndirectionuseInnerJoinFetchuseOuterJoinFetchusesIndirectionuseWeavedIndirectionvalidateBeforeInitializationvalueFromRowvalueFromRowInternalvalueFromRowInternalvalueFromRowInternalWithJoin