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

public Class ReferenceMapping

extends ObjectReferenceMapping
Class Inheritance
Imports
java.sql.Ref, .Struct, java.util.Map, .Vector, org.eclipse.persistence.exceptions.DatabaseException, .DescriptorException, .OptimisticLockException, .QueryException, org.eclipse.persistence.expressions.Expression, org.eclipse.persistence.indirection.ValueHolder, org.eclipse.persistence.internal.expressions.ObjectExpression, org.eclipse.persistence.internal.helper.DatabaseField, .DatabaseTable, org.eclipse.persistence.internal.identitymaps.CacheKey, org.eclipse.persistence.internal.queries.JoinedAttributeManager, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, .ChangeRecord, .ObjectChangeSet, .ObjectReferenceChangeRecord, .UnitOfWorkChangeSet, .UnitOfWorkImpl, org.eclipse.persistence.mappings.ObjectReferenceMapping, org.eclipse.persistence.queries.DeleteObjectQuery, .InsertObjectQuery, .ObjectBuildingQuery, .QueryByExamplePolicy, .WriteObjectQuery, org.eclipse.persistence.sessions.DatabaseRecord

Purpose: In an object-relational data model, structures reference each other through "Refs"; not through foreign keys as in the relational data model. TopLink supports using the Ref to reference the target object.

Field Summary

Modifier and TypeField and Description
protected DatabaseField
field

A ref is always stored in a single field.

Inherited from org.eclipse.persistence.mappings.ObjectReferenceMapping:
foreignKeyFieldsisForeignKeyRelationship

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
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.ObjectReferenceMapping.buildExpression.

INTERNAL: In case Query By Example is used, this method builds and returns an expression that corresponds to a single attribute and it's value.
protected Vector<E>
public DatabaseField
getField()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.getField.

INTERNAL: Returns the field which this mapping represents.
public String
getFieldName()

PUBLIC: Return the name of the field this mapping represents.

public Expression
getJoinCriteria(ObjectExpression context, Expression base)

Overrides org.eclipse.persistence.mappings.ForeignReferenceMapping.getJoinCriteria.

INTERNAL: Join criteria is created to read target records (nested table) from the table.
public boolean
hasConstraintDependency()

Overrides org.eclipse.persistence.mappings.ObjectReferenceMapping.hasConstraintDependency.

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

Set the field in the mapping.

public void
setFieldName(String fieldName)

PUBLIC: Set the field name in the mapping.

public void
setReferenceClass(Class<?> referenceClass)

Overrides org.eclipse.persistence.mappings.ForeignReferenceMapping.setReferenceClass.

PUBLIC: This is a reference class whose instances this mapping will store in the domain objects.
public Object
valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed)

Overrides org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromRow.

INTERNAL: Return the value of the field from the row or a value holder on the query to obtain the object.
public void
writeFromObjectIntoRow(Object object, AbstractRecord record, AbstractSession session, DatabaseMapping.WriteType writeType)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRow.

INTERNAL: Get a value from the object and set that in the respective field of the row.
public void
writeFromObjectIntoRowForShallowInsert(Object object, AbstractRecord record, AbstractSession session)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowForShallowInsert.

INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts.
public void
writeFromObjectIntoRowForShallowInsertWithChangeRecord(ChangeRecord changeRecord, AbstractRecord record, AbstractSession session)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowForShallowInsertWithChangeRecord.

INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts.
public void
writeFromObjectIntoRowForUpdateAfterShallowInsert(Object object, AbstractRecord record, AbstractSession session, DatabaseTable table)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowForUpdateAfterShallowInsert.

INTERNAL: This row is built for update after shallow insert which happens in case of bidirectional inserts.
public void
writeFromObjectIntoRowInternal(Object object, AbstractRecord record, AbstractSession session, boolean shouldIgnoreNull)

INTERNAL: Get a value from the object and set that in the respective field of the row.

public void
writeFromObjectIntoRowWithChangeRecord(ChangeRecord changeRecord, AbstractRecord record, AbstractSession session, DatabaseMapping.WriteType writeType)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowWithChangeRecord.

INTERNAL: Get a value from the object and set that in the respective field of the row.
public void
writeInsertFieldsIntoRow(AbstractRecord record, AbstractSession session)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeInsertFieldsIntoRow.

INTERNAL: Write fields needed for insert into the template for with null values.
Inherited from org.eclipse.persistence.mappings.ObjectReferenceMapping:
buildBackupCloneForPartObjectbuildChangeRecordbuildCloneForPartObjectbuildCopybuildReferencesPKListbuildTargetInterfacesbuildUnitofWorkCloneForPartObjectcascadeDiscoverAndPersistUnregisteredNewObjectscascadeDiscoverAndPersistUnregisteredNewObjectscascadePerformRemoveIfRequiredcascadePerformRemoveIfRequiredcascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequiredcascadeRegisterNewIfRequiredcascadeRegisterNewIfRequiredcollectQueryParameterscompareForChangecompareObjectsWithoutPrivateOwnedcompareObjectsWithPrivateOwnedcreateCloneValueHolderearlyPreDeleteextractPrimaryKeyRowForSourceObjectextractPrimaryKeysForReferenceObjectextractPrimaryKeysForReferenceObjectFromRowextractPrimaryKeysFromRealReferenceObjectfixRealObjectReferencesgetDescriptorForTargetgetForeignKeyFieldsgetPrimaryKeyForObjectgetRealAttributeValueFromAttributehasRelationTableMechanisminsertinternalBuildChangeRecordisChangeTrackingSupportedisForeignKeyRelationshipisObjectReferenceMappingiterateOnRealAttributeValueloadAllmergeChangesIntoObjectmergeIntoObjectpostCalculateChangespreInitializereadPrivateOwnedForObjectrecordPrivateOwnedRemovalssetForeignKeyFieldssetIsForeignKeyRelationshipsetNewValueInChangeRecordupdateupdateChangeRecordupdateChangeRecordForSelfMergeuseProxyIndirectionuseProxyIndirectionuseProxyIndirectionvalueFromPKListverifyDeletewriteFromObjectIntoRowForUpdatewriteFromObjectIntoRowForWhereClause

Field Detail

fieldback to summary
protected DatabaseField field

A ref is always stored in a single field.

Constructor Detail

ReferenceMappingback to summary
public ReferenceMapping()

Method Detail

buildExpressionback to summary
public Expression buildExpression(Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, Map<K, V> processedObjects, AbstractSession session)

Overrides org.eclipse.persistence.mappings.ObjectReferenceMapping.buildExpression.

INTERNAL: In case Query By Example is used, this method builds and returns an expression that corresponds to a single attribute and it's value.

Parameters
queryObject:Object

Doc from org.eclipse.persistence.mappings.DatabaseMapping.buildExpression.

TODO

policy:QueryByExamplePolicy

Doc from org.eclipse.persistence.mappings.DatabaseMapping.buildExpression.

TODO

expressionBuilder:Expression

Doc from org.eclipse.persistence.mappings.DatabaseMapping.buildExpression.

TODO

processedObjects:Map<K, V>

Doc from org.eclipse.persistence.mappings.DatabaseMapping.buildExpression.

TODO

session:AbstractSession

Doc from org.eclipse.persistence.mappings.DatabaseMapping.buildExpression.

TODO

Returns:Expression

Doc from org.eclipse.persistence.mappings.DatabaseMapping.buildExpression.

TODO

Annotations
@Override
collectFieldsback to summary
protected Vector<E> collectFields()

Overrides org.eclipse.persistence.mappings.ObjectReferenceMapping.collectFields.

Returns all the aggregate fields.

Returns:Vector<E>

Doc from org.eclipse.persistence.mappings.DatabaseMapping.collectFields.

TODO

Annotations
@Override
getFieldback to summary
public DatabaseField getField()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.getField.

INTERNAL: Returns the field which this mapping represents.

Returns:DatabaseField

Doc from org.eclipse.persistence.mappings.DatabaseMapping.getField.

TODO

Annotations
@Override
getFieldNameback to summary
public String getFieldName()

PUBLIC: Return the name of the field this mapping represents.

getJoinCriteriaback to summary
public Expression getJoinCriteria(ObjectExpression context, Expression base)

Overrides org.eclipse.persistence.mappings.ForeignReferenceMapping.getJoinCriteria.

INTERNAL: Join criteria is created to read target records (nested table) from the table.

Annotations
@Override
hasConstraintDependencyback to summary
public boolean hasConstraintDependency()

Overrides org.eclipse.persistence.mappings.ObjectReferenceMapping.hasConstraintDependency.

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

Annotations
@Override
initializeback to summary
public void initialize(AbstractSession session) throws DescriptorException

Overrides org.eclipse.persistence.mappings.ForeignReferenceMapping.initialize.

INTERNAL: Initialize the mapping.

Annotations
@Override
isReferenceMappingback to summary
public boolean isReferenceMapping()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.isReferenceMapping.

INTERNAL:

Returns:boolean

Doc from org.eclipse.persistence.core.mappings.CoreMapping.isReferenceMapping.

TODO

Annotations
@Override
isRelationalMappingback to summary
public boolean isRelationalMapping()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.isRelationalMapping.

INTERNAL:

Annotations
@Override
postDeleteback to summary
public void postDelete(DeleteObjectQuery query) throws DatabaseException, OptimisticLockException

Overrides org.eclipse.persistence.mappings.ObjectReferenceMapping.postDelete.

INTERNAL: Delete privately owned parts

Annotations
@Override
postInsertback to summary
public void postInsert(WriteObjectQuery query) throws DatabaseException, OptimisticLockException

Overrides org.eclipse.persistence.mappings.ObjectReferenceMapping.postInsert.

INTERNAL: Insert privately owned parts

Annotations
@Override
postUpdateback to summary
public void postUpdate(WriteObjectQuery query) throws DatabaseException, OptimisticLockException

Overrides org.eclipse.persistence.mappings.ObjectReferenceMapping.postUpdate.

INTERNAL: Update privately owned parts

Annotations
@Override
preDeleteback to summary
public void preDelete(DeleteObjectQuery query) throws DatabaseException, OptimisticLockException

Overrides org.eclipse.persistence.mappings.ObjectReferenceMapping.preDelete.

INTERNAL: Delete privately owned parts

Annotations
@Override
preInsertback to summary
public void preInsert(WriteObjectQuery query) throws DatabaseException, OptimisticLockException

Overrides org.eclipse.persistence.mappings.ObjectReferenceMapping.preInsert.

INTERNAL: Insert privately owned parts

Annotations
@Override
preUpdateback to summary
public void preUpdate(WriteObjectQuery query) throws DatabaseException, OptimisticLockException

Overrides org.eclipse.persistence.mappings.ObjectReferenceMapping.preUpdate.

INTERNAL: Update privately owned parts

Annotations
@Override
setFieldback to summary
protected void setField(DatabaseField field)

Set the field in the mapping.

setFieldNameback to summary
public void setFieldName(String fieldName)

PUBLIC: Set the field name in the mapping.

setReferenceClassback to summary
public void setReferenceClass(Class<?> referenceClass)

Overrides org.eclipse.persistence.mappings.ForeignReferenceMapping.setReferenceClass.

PUBLIC: This is a reference class whose instances this mapping will store in the domain objects.

Annotations
@Override
valueFromRowback to summary
public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed) throws DatabaseException

Overrides org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromRow.

INTERNAL: Return the value of the field from the row or a value holder on the query to obtain the object. Check for batch + aggregation reading.

Annotations
@Override
writeFromObjectIntoRowback to summary
public void writeFromObjectIntoRow(Object object, AbstractRecord record, AbstractSession session, DatabaseMapping.WriteType writeType)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRow.

INTERNAL: Get a value from the object and set that in the respective field of the row.

Annotations
@Override
writeFromObjectIntoRowForShallowInsertback to summary
public void writeFromObjectIntoRowForShallowInsert(Object object, AbstractRecord record, AbstractSession session)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowForShallowInsert.

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.

Annotations
@Override
writeFromObjectIntoRowForShallowInsertWithChangeRecordback to summary
public void writeFromObjectIntoRowForShallowInsertWithChangeRecord(ChangeRecord changeRecord, AbstractRecord record, AbstractSession session)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowForShallowInsertWithChangeRecord.

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.

Annotations
@Override
writeFromObjectIntoRowForUpdateAfterShallowInsertback to summary
public void writeFromObjectIntoRowForUpdateAfterShallowInsert(Object object, AbstractRecord record, AbstractSession session, DatabaseTable table)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowForUpdateAfterShallowInsert.

INTERNAL: This row is built for update after shallow insert which happens in case of bidirectional inserts. It contains the foreign keys with non null values that were set to null for shallow insert.

Annotations
@Override
writeFromObjectIntoRowInternalback to summary
public void writeFromObjectIntoRowInternal(Object object, AbstractRecord record, AbstractSession session, boolean shouldIgnoreNull)

INTERNAL: Get a value from the object and set that in the respective field of the row.

writeFromObjectIntoRowWithChangeRecordback to summary
public void writeFromObjectIntoRowWithChangeRecord(ChangeRecord changeRecord, AbstractRecord record, AbstractSession session, DatabaseMapping.WriteType writeType)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowWithChangeRecord.

INTERNAL: Get a value from the object and set that in the respective field of the row.

Annotations
@Override
writeInsertFieldsIntoRowback to summary
public void writeInsertFieldsIntoRow(AbstractRecord record, AbstractSession session)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeInsertFieldsIntoRow.

INTERNAL: Write fields needed for insert into the template for with null values.

Annotations
@Override