EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference

org.eclipse.persistence.mappings.structures
Class ReferenceMapping

java.lang.Object
  extended by org.eclipse.persistence.mappings.DatabaseMapping
      extended by org.eclipse.persistence.mappings.ForeignReferenceMapping
          extended by org.eclipse.persistence.mappings.ObjectReferenceMapping
              extended by org.eclipse.persistence.mappings.structures.ReferenceMapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class ReferenceMapping
extends ObjectReferenceMapping

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.

See Also:
Serialized Form

Field Summary
protected  org.eclipse.persistence.internal.helper.DatabaseField field
          A ref is always stored in a single field.
 
Fields inherited from class org.eclipse.persistence.mappings.ObjectReferenceMapping
foreignKeyFields, isForeignKeyRelationship
 
Fields inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping
cascadeMerge, cascadePersist, cascadeRefresh, cascadeRemove, forceInitializationOfSelectionCriteria, hasCustomSelectionQuery, indirectionPolicy, INNER_JOIN, isPrivateOwned, joinFetch, NONE, OUTER_JOIN, referenceClass, referenceClassName, referenceDescriptor, relationshipPartner, relationshipPartnerAttributeName, requiresTransientWeavedFields, selectionQuery, tempInitSession, usesBatchReading
 
Fields inherited from class org.eclipse.persistence.mappings.DatabaseMapping
attributeAccessor, attributeName, descriptor, fields, isLazy, isOptional, isPrimaryKeyMapping, isReadOnly, isRemotelyInitialized, NO_FIELDS, NO_WEIGHT, properties, weight, WEIGHT_1
 
Constructor Summary
ReferenceMapping()
           
 
Method Summary
protected  java.util.Vector collectFields()
          Returns all the aggregate fields.
 org.eclipse.persistence.internal.helper.DatabaseField getField()
          INTERNAL: Returns the field which this mapping represents.
 java.lang.String getFieldName()
          PUBLIC: Return the name of the field this mapping represents.
 Expression getJoinCriteria(org.eclipse.persistence.internal.expressions.QueryKeyExpression exp)
          INTERNAL: Join criteria is created to read target records (nested table) from the table.
 boolean hasConstraintDependency()
          INTERNAL: The returns if the mapping has any constraint dependencies, such as foreign keys and join tables.
 void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Initialize the mapping.
 boolean isReferenceMapping()
          INTERNAL:
 void postDelete(DeleteObjectQuery query)
          INTERNAL: Delete privately owned parts
 void postInsert(WriteObjectQuery query)
          INTERNAL: Insert privately owned parts
 void postUpdate(WriteObjectQuery query)
          INTERNAL: Update privately owned parts
 void preDelete(DeleteObjectQuery query)
          INTERNAL: Delete privately owned parts
 void preInsert(WriteObjectQuery query)
          INTERNAL: Insert privately owned parts
 void preUpdate(WriteObjectQuery query)
          INTERNAL: Update privately owned parts
protected  void setField(org.eclipse.persistence.internal.helper.DatabaseField field)
          Set the field in the mapping.
 void setFieldName(java.lang.String fieldName)
          PUBLIC: Set the field name in the mapping.
 void setReferenceClass(java.lang.Class referenceClass)
          PUBLIC: This is a reference class whose instances this mapping will store in the domain objects.
 java.lang.Object valueFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery query, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
          INTERNAL: Return the value of the field from the row or a value holder on the query to obtain the object.
 void writeFromObjectIntoRow(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractRecord record, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Get a value from the object and set that in the respective field of the row.
 void writeFromObjectIntoRowForShallowInsert(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractRecord record, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts.
 void writeFromObjectIntoRowForShallowInsertWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, org.eclipse.persistence.internal.sessions.AbstractRecord record, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts.
 void writeFromObjectIntoRowWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, org.eclipse.persistence.internal.sessions.AbstractRecord record, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Get a value from the object and set that in the respective field of the row.
 void writeInsertFieldsIntoRow(org.eclipse.persistence.internal.sessions.AbstractRecord record, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Write fields needed for insert into the template for with null values.
 
Methods inherited from class org.eclipse.persistence.mappings.ObjectReferenceMapping
buildBackupCloneForPartObject, buildChangeRecord, buildCloneForPartObject, buildCopy, buildExpression, buildReferencesPKList, buildTargetInterfaces, cacheKeysAreEqual, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadePerformRemoveIfRequired, cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired, cascadeRegisterNewIfRequired, compareForChange, compareObjectsWithoutPrivateOwned, compareObjectsWithPrivateOwned, createUnitOfWorkValueHolder, extractPrimaryKeyRowForSourceObject, extractPrimaryKeysForReferenceObject, extractPrimaryKeysForReferenceObjectFromRow, extractPrimaryKeysFromRealReferenceObject, fixRealObjectReferences, getDescriptorForTarget, getForeignKeyFields, getPrimaryKeyForObject, getRealAttributeValueFromAttribute, insert, internalBuildChangeRecord, isChangeTrackingSupported, isForeignKeyRelationship, isObjectReferenceMapping, iterateOnRealAttributeValue, mergeChangesIntoObject, mergeIntoObject, preInitialize, readPrivateOwnedForObject, setForeignKeyFields, setIsForeignKeyRelationship, setNewValueInChangeRecord, update, updateChangeRecord, useProxyIndirection, useProxyIndirection, useProxyIndirection, valueFromPKList, verifyDelete, writeFromObjectIntoRowForUpdate, writeFromObjectIntoRowForWhereClause
 
Methods inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping
batchedValueFromRow, buildBackupClone, buildClone, buildCloneFromRow, clone, compareObjects, convertClassNamesToClasses, dontDoMerge, dontUseBatchReading, dontUseIndirection, extractResultFromBatchQuery, fixObjectReferences, getAttributeValueFromObject, getAttributeValueWithClonedValueHolders, getBatchReadObjects, getIndirectionPolicy, getJoinFetch, getObjectCorrespondingTo, getReferenceClass, getReferenceClassName, getReferenceDescriptor, getRelationshipPartner, getRelationshipPartnerAttributeName, getSelectionCriteria, getSelectionQuery, getTempSession, getValueFromRemoteValueHolder, hasCustomSelectionQuery, initializeReferenceDescriptor, initializeSelectionQuery, instantiateAttribute, isAttributeValueInstantiated, isCascadeMerge, isCascadePersist, isCascadeRefresh, isCascadeRemove, isForeignReferenceMapping, isInnerJoinFetched, isJoinFetched, isJoiningSupported, isLazy, isOuterJoinFetched, isPrivateOwned, iterate, mergeRemoteValueHolder, postPrepareNestedBatchQuery, prepareHistoricalQuery, prepareNestedBatchQuery, prepareNestedJoinQueryClone, prepareNestedJoins, privateOwnedRelationship, remoteInitialization, replaceValueHoldersIn, requiresTransientWeavedFields, setBatchReadObjects, setCascadeAll, setCascadeMerge, setCascadePersist, setCascadeRefresh, setCascadeRemove, setCustomSelectionQuery, setForceInitializationOfSelectionCriteria, setHasCustomSelectionQuery, setIndirectionPolicy, setIsPrivateOwned, setJoinFetch, setRealAttributeValueInObject, setReferenceClassName, setReferenceDescriptor, setRelationshipPartner, setRelationshipPartnerAttributeName, setRequiresTransientWeavedFields, setSelectionCall, setSelectionCriteria, setSelectionQuery, setSelectionSQLString, setTempSession, setUsesBatchReading, setUsesIndirection, shouldForceInitializationOfSelectionCriteria, shouldInitializeSelectionCriteria, shouldMergeCascadeParts, shouldMergeCascadeReference, shouldObjectModifyCascadeToParts, shouldUseBatchReading, shouldUseValueFromRowWithJoin, trimRowForJoin, trimRowForJoin, useBasicIndirection, useBatchReading, useContainerIndirection, useInnerJoinFetch, useOuterJoinFetch, usesIndirection, useWeavedIndirection, validateBeforeInitialization, valueFromRowInternal, valueFromRowInternalWithJoin
 
Methods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
addToCollectionChangeRecord, buildObjectJoinExpression, buildObjectJoinExpression, buildShallowOriginalFromRow, calculateDeferredChanges, cascadeMerge, cloneFields, extractNestedExpressions, getAttributeAccessor, getAttributeClassification, getAttributeName, getContainerPolicy, getDescriptor, getFieldClassification, getFields, getGetMethodName, getProperties, getProperty, getRealAttributeValueFromObject, getRealCollectionAttributeValueFromObject, getSelectFields, getSelectTables, getSetMethodName, getWeight, hasDependency, hasInverseConstraintDependency, hasRootExpressionThatShouldUseOuterJoin, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isCandidateForPrivateOwnedRemoval, isCascadedLockingSupported, isCloningRequired, isCollectionMapping, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isManyToManyMapping, isNestedTableMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isRelationalMapping, isRemotelyInitialized, isStructureMapping, isTransformationMapping, isUnidirectionalOneToManyMapping, isUsingMethodAccess, isVariableOneToOneMapping, isWriteOnly, isXMLMapping, performDataModificationEvent, postCalculateChanges, postCalculateChangesOnDeleted, postInitialize, prepareCascadeLockingPolicy, readFromResultSetIntoObject, readFromRowIntoObject, readOnly, readWrite, rehashFieldDependancies, remotelyInitialized, removeFromCollectionChangeRecord, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setChangeListener, setDescriptor, setFields, setGetMethodName, setIsLazy, setIsOptional, setIsPrimaryKeyMapping, setIsReadOnly, setProperties, setProperty, setSetMethodName, setWeight, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, toString, updateCollectionChangeRecord, validateAfterInitialization, valueFromObject, valueFromResultSet, valueFromRow, writeFromAttributeIntoRow, writeUpdateFieldsIntoRow
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

field

protected org.eclipse.persistence.internal.helper.DatabaseField field
A ref is always stored in a single field.

Constructor Detail

ReferenceMapping

public ReferenceMapping()
Method Detail

collectFields

protected java.util.Vector collectFields()
Returns all the aggregate fields.

Overrides:
collectFields in class ObjectReferenceMapping

getField

public org.eclipse.persistence.internal.helper.DatabaseField getField()
INTERNAL: Returns the field which this mapping represents.

Overrides:
getField in class DatabaseMapping

getFieldName

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


getJoinCriteria

public Expression getJoinCriteria(org.eclipse.persistence.internal.expressions.QueryKeyExpression exp)
INTERNAL: Join criteria is created to read target records (nested table) from the table.

Overrides:
getJoinCriteria in class ForeignReferenceMapping

hasConstraintDependency

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

Overrides:
hasConstraintDependency in class ObjectReferenceMapping

initialize

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

Overrides:
initialize in class ForeignReferenceMapping
Throws:
DescriptorException

isReferenceMapping

public boolean isReferenceMapping()
INTERNAL:

Overrides:
isReferenceMapping in class DatabaseMapping

preInsert

public void preInsert(WriteObjectQuery query)
               throws DatabaseException,
                      OptimisticLockException
INTERNAL: Insert privately owned parts

Overrides:
preInsert in class ObjectReferenceMapping
Throws:
DatabaseException
OptimisticLockException

preUpdate

public void preUpdate(WriteObjectQuery query)
               throws DatabaseException,
                      OptimisticLockException
INTERNAL: Update privately owned parts

Overrides:
preUpdate in class ObjectReferenceMapping
Throws:
DatabaseException
OptimisticLockException

postInsert

public void postInsert(WriteObjectQuery query)
                throws DatabaseException,
                       OptimisticLockException
INTERNAL: Insert privately owned parts

Overrides:
postInsert in class ObjectReferenceMapping
Throws:
DatabaseException
OptimisticLockException

postDelete

public void postDelete(DeleteObjectQuery query)
                throws DatabaseException,
                       OptimisticLockException
INTERNAL: Delete privately owned parts

Overrides:
postDelete in class ObjectReferenceMapping
Throws:
DatabaseException
OptimisticLockException

postUpdate

public void postUpdate(WriteObjectQuery query)
                throws DatabaseException,
                       OptimisticLockException
INTERNAL: Update privately owned parts

Overrides:
postUpdate in class ObjectReferenceMapping
Throws:
DatabaseException
OptimisticLockException

preDelete

public void preDelete(DeleteObjectQuery query)
               throws DatabaseException,
                      OptimisticLockException
INTERNAL: Delete privately owned parts

Overrides:
preDelete in class ObjectReferenceMapping
Throws:
DatabaseException
OptimisticLockException

setField

protected void setField(org.eclipse.persistence.internal.helper.DatabaseField field)
Set the field in the mapping.


setFieldName

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


setReferenceClass

public void setReferenceClass(java.lang.Class referenceClass)
PUBLIC: This is a reference class whose instances this mapping will store in the domain objects.

Overrides:
setReferenceClass in class ForeignReferenceMapping

valueFromRow

public java.lang.Object valueFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                     org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                     ObjectBuildingQuery query,
                                     org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
                              throws DatabaseException
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.

Overrides:
valueFromRow in class ForeignReferenceMapping
Throws:
DatabaseException

writeFromObjectIntoRow

public void writeFromObjectIntoRow(java.lang.Object object,
                                   org.eclipse.persistence.internal.sessions.AbstractRecord record,
                                   org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Get a value from the object and set that in the respective field of the row.

Overrides:
writeFromObjectIntoRow in class DatabaseMapping

writeFromObjectIntoRowWithChangeRecord

public void writeFromObjectIntoRowWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord,
                                                   org.eclipse.persistence.internal.sessions.AbstractRecord record,
                                                   org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Get a value from the object and set that in the respective field of the row.

Overrides:
writeFromObjectIntoRowWithChangeRecord in class DatabaseMapping

writeFromObjectIntoRowForShallowInsert

public void writeFromObjectIntoRowForShallowInsert(java.lang.Object object,
                                                   org.eclipse.persistence.internal.sessions.AbstractRecord record,
                                                   org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts. The foreign keys must be set to null to avoid constraints.

Overrides:
writeFromObjectIntoRowForShallowInsert in class DatabaseMapping

writeFromObjectIntoRowForShallowInsertWithChangeRecord

public void writeFromObjectIntoRowForShallowInsertWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord,
                                                                   org.eclipse.persistence.internal.sessions.AbstractRecord record,
                                                                   org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts. The foreign keys must be set to null to avoid constraints.

Overrides:
writeFromObjectIntoRowForShallowInsertWithChangeRecord in class DatabaseMapping

writeInsertFieldsIntoRow

public void writeInsertFieldsIntoRow(org.eclipse.persistence.internal.sessions.AbstractRecord record,
                                     org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Write fields needed for insert into the template for with null values.

Overrides:
writeInsertFieldsIntoRow in class DatabaseMapping

EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference