EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference

org.eclipse.persistence.mappings
Class OneToOneMapping

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.OneToOneMapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, MapComponentMapping, MapKeyMapping, RelationalMapping

public class OneToOneMapping
extends ObjectReferenceMapping
implements RelationalMapping, MapKeyMapping

Purpose: One to one mappings are used to represent a pointer references between two java objects. This mappings is usually represented by a single pointer (stored in an instance variable) between the source and target objects. In the relational database tables, these mappings are normally implemented using foreign keys.

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

Field Summary
protected  Expression privateOwnedCriteria
           
protected  boolean shouldVerifyDelete
          These are used for non-unit of work modification to check if the value of the 1-1 was changed and a deletion is required.
protected  java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> sourceToTargetKeyFields
          Maps the source foreign/primary key fields to the target primary/foreign key fields.
protected  java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> targetToSourceKeyFields
          Maps the target primary/foreign key fields to the source foreign/primary key fields.
 
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
OneToOneMapping()
          PUBLIC: Default constructor.
 
Method Summary
 void addForeignKeyField(org.eclipse.persistence.internal.helper.DatabaseField sourceForeignKeyField, org.eclipse.persistence.internal.helper.DatabaseField targetPrimaryKeyField)
          PUBLIC: Define the foreign key relationship in the 1-1 mapping.
 void addForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName, java.lang.String targetPrimaryKeyFieldName)
          PUBLIC: Define the foreign key relationship in the 1-1 mapping.
 void addTargetForeignKeyField(org.eclipse.persistence.internal.helper.DatabaseField targetForeignKeyField, org.eclipse.persistence.internal.helper.DatabaseField sourcePrimaryKeyField)
          PUBLIC: Define the target foreign key relationship in the 1-1 mapping.
 void addTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName, java.lang.String sourcePrimaryKeyFieldName)
          PUBLIC: Define the target foreign key relationship in the 1-1 mapping.
 Expression buildObjectJoinExpression(Expression expression, Expression argument, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Used to allow object level comparisons.
 Expression buildObjectJoinExpression(Expression expression, java.lang.Object value, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Used to allow object level comparisons.
 Expression buildSelectionCriteria()
          This method would allow customers to get the potential selection criteria for a mapping prior to initialization.
 void buildShallowOriginalFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, java.lang.Object original, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery query, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
          INTERNAL: Builds a shallow original object.
 java.lang.Object clone()
          INTERNAL: This methods clones all the fields and ensures that each collection refers to the same clones.
protected  java.util.Vector extractForeignKeyFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Extract the foreign key value from the source row.
protected  java.util.Vector extractKeyFromReferenceObject(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Extract the key value from the reference object.
 java.util.Vector extractPrimaryKeysForReferenceObjectFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row)
          INTERNAL: Return the primary key for the reference object (i.e. the object object referenced by domainObject and specified by mapping).
 java.lang.Object extractResultFromBatchQuery(DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord argumentRow)
          INTERNAL: Extract the value from the batch optimized query.
 java.lang.Class getFieldClassification(org.eclipse.persistence.internal.helper.DatabaseField fieldToClassify)
          INTERNAL: Return the classifiction for the field contained in the mapping.
 java.util.Vector getForeignKeyFieldNames()
          PUBLIC: Return the foreign key field names associated with the mapping.
protected  java.util.Map getForeignKeysToPrimaryKeys()
          Return the appropriate hashtable that maps the "foreign keys" to the "primary keys".
 java.util.Vector getOrderedForeignKeyFields()
          INTERNAL: Return a vector of the foreign key fields in the same order as the corresponding primary key fields are in their descriptor.
protected  ClassDescriptor getPrimaryKeyDescriptor()
          Return the descriptor for whichever side of the relation has the "primary key".
 Expression getPrivateOwnedCriteria()
          INTERNAL: The private owned criteria is only used outside of the unit of work to compare the previous value of the reference.
 java.util.Vector getSourceToTargetKeyFieldAssociations()
          INTERNAL: Return a collection of the source to target field value associations.
 java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getSourceToTargetKeyFields()
          INTERNAL: Returns the source keys to target keys fields association.
 java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getTargetToSourceKeyFields()
          INTERNAL: Returns the target keys to source keys fields association.
 void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Initialize the mapping.
protected  void initializeForeignKeys(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: The foreign keys primary keys are stored as database fields in the hashtable.
protected  void initializeForeignKeysWithDefaults(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: The foreign keys primary keys are stored as database fields in the hashtable.
protected  void initializePrivateOwnedCriteria()
          INTERNAL: Selection criteria is created with source foreign keys and target keys.
protected  void initializeSelectionCriteria(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Selection criteria is created with source foreign keys and target keys.
 boolean isCascadedLockingSupported()
          INTERNAL Return true if this mapping supports cascaded version optimistic locking.
 boolean isJoiningSupported()
          INTERNAL: Return if this mapping support joining.
 boolean isOneToOneMapping()
          INTERNAL:
 boolean isRelationalMapping()
          INTERNAL:
protected  void postPrepareNestedBatchQuery(ReadQuery batchQuery, ReadAllQuery query)
          INTERNAL: Allow the mapping the do any further batch preparation.
 void prepareCascadeLockingPolicy()
          INTERNAL: Prepare a cascade locking policy.
protected  java.lang.Object readPrivateOwnedForObject(ObjectLevelModifyQuery modifyQuery)
          INTERNAL: Reads the private owned object.
 void rehashFieldDependancies(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Rehash any hashtables based on fields.
 void setForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName)
          PUBLIC: Define the foreign key relationship in the 1-1 mapping.
 void setForeignKeyFieldNames(java.util.Vector fieldNames)
          PUBLIC: Return the foreign key field names associated with the mapping.
protected  void setPrivateOwnedCriteria(Expression expression)
          INTERNAL: Private owned criteria is used to verify the deletion of the target.
 void setShouldVerifyDelete(boolean shouldVerifyDelete)
          PUBLIC: Verify delete is used during delete and update on private 1:1's outside of a unit of work only.
 void setSourceToTargetKeyFieldAssociations(java.util.Vector sourceToTargetKeyFieldAssociations)
          INTERNAL: Set a collection of the source to target field associations.
 void setSourceToTargetKeyFields(java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> sourceToTargetKeyFields)
          INTERNAL: Set the source keys to target keys fields association.
 void setTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName)
          PUBLIC: Define the target foreign key relationship in the 1-1 mapping.
 void setTargetToSourceKeyFields(java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> targetToSourceKeyFields)
          INTERNAL: Set the target keys to source keys fields association.
 boolean shouldVerifyDelete()
          PUBLIC: Verify delete is used during delete and update outside of a unit of work only.
 java.lang.Object valueFromObject(java.lang.Object object, org.eclipse.persistence.internal.helper.DatabaseField field, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Get a value from the object and set that in the respective field of the row.
protected  java.lang.Object valueFromRowInternal(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, 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.
protected  java.lang.Object valueFromRowInternalWithJoin(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, 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 writeFromAttributeIntoRow(java.lang.Object attribute, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: A subclass should implement this method if it wants different behavior.
 void writeFromObjectIntoRow(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, 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 databaseRow, 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 databaseRow, 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 databaseRow, 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 databaseRow, 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, collectFields, compareForChange, compareObjectsWithoutPrivateOwned, compareObjectsWithPrivateOwned, createUnitOfWorkValueHolder, extractPrimaryKeyRowForSourceObject, extractPrimaryKeysForReferenceObject, extractPrimaryKeysFromRealReferenceObject, fixRealObjectReferences, getDescriptorForTarget, getForeignKeyFields, getPrimaryKeyForObject, getRealAttributeValueFromAttribute, hasConstraintDependency, insert, internalBuildChangeRecord, isChangeTrackingSupported, isForeignKeyRelationship, isObjectReferenceMapping, iterateOnRealAttributeValue, mergeChangesIntoObject, mergeIntoObject, postDelete, postInsert, postUpdate, preDelete, preInitialize, preInsert, preUpdate, 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, compareObjects, convertClassNamesToClasses, dontDoMerge, dontUseBatchReading, dontUseIndirection, fixObjectReferences, getAttributeValueFromObject, getAttributeValueWithClonedValueHolders, getBatchReadObjects, getIndirectionPolicy, getJoinCriteria, getJoinFetch, getObjectCorrespondingTo, 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, prepareHistoricalQuery, prepareNestedBatchQuery, prepareNestedJoinQueryClone, prepareNestedJoins, privateOwnedRelationship, remoteInitialization, replaceValueHoldersIn, requiresTransientWeavedFields, setBatchReadObjects, setCascadeAll, setCascadeMerge, setCascadePersist, setCascadeRefresh, setCascadeRemove, setCustomSelectionQuery, setForceInitializationOfSelectionCriteria, setHasCustomSelectionQuery, setIndirectionPolicy, setIsPrivateOwned, setJoinFetch, setRealAttributeValueInObject, setReferenceClass, 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, valueFromRow
 
Methods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
addToCollectionChangeRecord, calculateDeferredChanges, cascadeMerge, cloneFields, extractNestedExpressions, getAttributeAccessor, getAttributeClassification, getAttributeName, getContainerPolicy, getDescriptor, getField, getFields, getGetMethodName, getProperties, getProperty, getRealAttributeValueFromObject, getRealCollectionAttributeValueFromObject, getSelectFields, getSelectTables, getSetMethodName, getWeight, hasDependency, hasInverseConstraintDependency, hasRootExpressionThatShouldUseOuterJoin, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isCandidateForPrivateOwnedRemoval, isCloningRequired, isCollectionMapping, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isManyToManyMapping, isNestedTableMapping, isOneToManyMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isReferenceMapping, isRemotelyInitialized, isStructureMapping, isTransformationMapping, isUnidirectionalOneToManyMapping, isUsingMethodAccess, isVariableOneToOneMapping, isWriteOnly, isXMLMapping, performDataModificationEvent, postCalculateChanges, postCalculateChangesOnDeleted, postInitialize, readFromResultSetIntoObject, readFromRowIntoObject, readOnly, readWrite, remotelyInitialized, removeFromCollectionChangeRecord, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setChangeListener, setDescriptor, setFields, setGetMethodName, setIsLazy, setIsOptional, setIsPrimaryKeyMapping, setIsReadOnly, setProperties, setProperty, setSetMethodName, setWeight, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, toString, updateCollectionChangeRecord, validateAfterInitialization, valueFromResultSet, valueFromRow, writeUpdateFieldsIntoRow
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sourceToTargetKeyFields

protected java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> sourceToTargetKeyFields
Maps the source foreign/primary key fields to the target primary/foreign key fields.


targetToSourceKeyFields

protected java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> targetToSourceKeyFields
Maps the target primary/foreign key fields to the source foreign/primary key fields.


shouldVerifyDelete

protected boolean shouldVerifyDelete
These are used for non-unit of work modification to check if the value of the 1-1 was changed and a deletion is required.


privateOwnedCriteria

protected transient Expression privateOwnedCriteria
Constructor Detail

OneToOneMapping

public OneToOneMapping()
PUBLIC: Default constructor.

Method Detail

isRelationalMapping

public boolean isRelationalMapping()
INTERNAL:

Overrides:
isRelationalMapping in class DatabaseMapping

addForeignKeyField

public void addForeignKeyField(org.eclipse.persistence.internal.helper.DatabaseField sourceForeignKeyField,
                               org.eclipse.persistence.internal.helper.DatabaseField targetPrimaryKeyField)
PUBLIC: Define the foreign key relationship in the 1-1 mapping. This method is used for composite foreign key relationships, that is the source object's table has multiple foreign key fields to the target object's primary key fields. Both the source foreign key field and the target foreign key field must be specified. When a foreign key is specified TopLink will automatically populate the value for that field from the target object when the object is written to the database. If the foreign key is also mapped through a direct-to-field then the direct-to-field must be set read-only.


addForeignKeyFieldName

public void addForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName,
                                   java.lang.String targetPrimaryKeyFieldName)
PUBLIC: Define the foreign key relationship in the 1-1 mapping. This method is used for composite foreign key relationships, that is the source object's table has multiple foreign key fields to the target object's primary key fields. Both the source foreign key field name and the target foreign key field name must be specified. When a foreign key is specified TopLink will automatically populate the value for that field from the target object when the object is written to the database. If the foreign key is also mapped through a direct-to-field then the direct-to-field must be set read-only.


addTargetForeignKeyField

public void addTargetForeignKeyField(org.eclipse.persistence.internal.helper.DatabaseField targetForeignKeyField,
                                     org.eclipse.persistence.internal.helper.DatabaseField sourcePrimaryKeyField)
PUBLIC: Define the target foreign key relationship in the 1-1 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 primary key fields. Both the target foreign key field and the source primary key field must be specified. The distinction between a foreign key and target foreign key is that the 1-1 mapping will not populate the target foreign key value when written (because it is in the target table). Normally 1-1's are through foreign keys but in bi-directional 1-1's the back reference will be a target foreign key. In obscure composite legacy data models a 1-1 may consist of a foreign key part and a target foreign key part, in this case both method will be called with the correct parts.


addTargetForeignKeyFieldName

public void addTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName,
                                         java.lang.String sourcePrimaryKeyFieldName)
PUBLIC: Define the target foreign key relationship in the 1-1 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 primary key fields. Both the target foreign key field name and the source primary key field name must be specified. The distinction between a foreign key and target foreign key is that the 1-1 mapping will not populate the target foreign key value when written (because it is in the target table). Normally 1-1's are through foreign keys but in bi-directional 1-1's the back reference will be a target foreign key. In obscure composite legacy data models a 1-1 may consist of a foreign key part and a target foreign key part, in this case both method will be called with the correct parts.


buildObjectJoinExpression

public Expression buildObjectJoinExpression(Expression expression,
                                            java.lang.Object value,
                                            org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Used to allow object level comparisons.

Overrides:
buildObjectJoinExpression in class DatabaseMapping

buildObjectJoinExpression

public Expression buildObjectJoinExpression(Expression expression,
                                            Expression argument,
                                            org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Used to allow object level comparisons.

Overrides:
buildObjectJoinExpression in class DatabaseMapping

clone

public java.lang.Object clone()
INTERNAL: This methods clones all the fields and ensures that each collection refers to the same clones.

Overrides:
clone in class ForeignReferenceMapping

extractForeignKeyFromRow

protected java.util.Vector extractForeignKeyFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                                    org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Extract the foreign key value from the source row.


extractKeyFromReferenceObject

protected java.util.Vector extractKeyFromReferenceObject(java.lang.Object object,
                                                         org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Extract the key value from the reference object.


extractPrimaryKeysForReferenceObjectFromRow

public java.util.Vector extractPrimaryKeysForReferenceObjectFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row)
INTERNAL: Return the primary key for the reference object (i.e. the object object referenced by domainObject and specified by mapping). This key will be used by a RemoteValueHolder.

Overrides:
extractPrimaryKeysForReferenceObjectFromRow in class ObjectReferenceMapping

postPrepareNestedBatchQuery

protected void postPrepareNestedBatchQuery(ReadQuery batchQuery,
                                           ReadAllQuery query)
INTERNAL: Allow the mapping the do any further batch preparation.

Overrides:
postPrepareNestedBatchQuery in class ForeignReferenceMapping

extractResultFromBatchQuery

public java.lang.Object extractResultFromBatchQuery(DatabaseQuery query,
                                                    org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                                    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

getFieldClassification

public java.lang.Class getFieldClassification(org.eclipse.persistence.internal.helper.DatabaseField fieldToClassify)
                                       throws DescriptorException
INTERNAL: Return the classifiction for the field contained in the mapping. This is used to convert the row value to a consistent java value.

Overrides:
getFieldClassification in class DatabaseMapping
Throws:
DescriptorException

getForeignKeyFieldNames

public java.util.Vector getForeignKeyFieldNames()
PUBLIC: Return the foreign key field names associated with the mapping. These are only the source fields that are writable.


getForeignKeysToPrimaryKeys

protected java.util.Map getForeignKeysToPrimaryKeys()
Return the appropriate hashtable that maps the "foreign keys" to the "primary keys".


getOrderedForeignKeyFields

public java.util.Vector getOrderedForeignKeyFields()
INTERNAL: Return a vector of the foreign key fields in the same order as the corresponding primary key fields are in their descriptor.


getPrimaryKeyDescriptor

protected ClassDescriptor getPrimaryKeyDescriptor()
Return the descriptor for whichever side of the relation has the "primary key".


getPrivateOwnedCriteria

public Expression getPrivateOwnedCriteria()
INTERNAL: The private owned criteria is only used outside of the unit of work to compare the previous value of the reference.


getSourceToTargetKeyFieldAssociations

public java.util.Vector getSourceToTargetKeyFieldAssociations()
INTERNAL: Return a collection of the source to target field value associations.


getSourceToTargetKeyFields

public java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getSourceToTargetKeyFields()
INTERNAL: Returns the source keys to target keys fields association.


getTargetToSourceKeyFields

public java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getTargetToSourceKeyFields()
INTERNAL: Returns the target keys to source keys fields association.


initialize

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

Overrides:
initialize in class ForeignReferenceMapping
Throws:
DescriptorException

initializeForeignKeys

protected void initializeForeignKeys(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: The foreign keys primary keys are stored as database fields in the hashtable.


initializeForeignKeysWithDefaults

protected void initializeForeignKeysWithDefaults(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: The foreign keys primary keys are stored as database fields in the hashtable.


initializePrivateOwnedCriteria

protected void initializePrivateOwnedCriteria()
INTERNAL: Selection criteria is created with source foreign keys and target keys.


initializeSelectionCriteria

protected void initializeSelectionCriteria(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Selection criteria is created with source foreign keys and target keys. This criteria is then used to read target records from the table. CR#3922 - This method is almost the same as buildSelectionCriteria() the difference is that getSelectionCriteria() is called


prepareCascadeLockingPolicy

public void prepareCascadeLockingPolicy()
INTERNAL: Prepare a cascade locking policy.

Overrides:
prepareCascadeLockingPolicy in class DatabaseMapping

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 initializeSelectionCriteria() the difference is that getSelectionCriteria() is not called


buildShallowOriginalFromRow

public void buildShallowOriginalFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                        java.lang.Object original,
                                        org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                        ObjectBuildingQuery query,
                                        org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
INTERNAL: Builds a shallow original object. Only direct attributes and primary keys are populated. In this way the minimum original required for instantiating a working copy clone can be built without placing it in the shared cache (no concern over cycles).

Overrides:
buildShallowOriginalFromRow in class DatabaseMapping

isOneToOneMapping

public boolean isOneToOneMapping()
INTERNAL:

Overrides:
isOneToOneMapping in class DatabaseMapping

readPrivateOwnedForObject

protected java.lang.Object readPrivateOwnedForObject(ObjectLevelModifyQuery modifyQuery)
                                              throws DatabaseException
INTERNAL: Reads the private owned object.

Overrides:
readPrivateOwnedForObject in class ObjectReferenceMapping
Throws:
DatabaseException

rehashFieldDependancies

public void rehashFieldDependancies(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Rehash any hashtables based on fields. This is used to clone descriptors for aggregates, which hammer field names, it is probably better not to hammer the field name and this should be refactored.

Overrides:
rehashFieldDependancies in class DatabaseMapping

setForeignKeyFieldName

public void setForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName)
PUBLIC: Define the foreign key relationship in the 1-1 mapping. This method is used for singleton foreign key relationships only, that is the source object's table has a foreign key field to the target object's primary key field. Only the source foreign key field name is specified. When a foreign key is specified TopLink will automatically populate the value for that field from the target object when the object is written to the database. If the foreign key is also mapped through a direct-to-field then the direct-to-field must be set read-only.


setForeignKeyFieldNames

public void setForeignKeyFieldNames(java.util.Vector fieldNames)
PUBLIC: Return the foreign key field names associated with the mapping. These are only the source fields that are writable.


setPrivateOwnedCriteria

protected void setPrivateOwnedCriteria(Expression expression)
INTERNAL: Private owned criteria is used to verify the deletion of the target. It joins from the source table on the foreign key to the target table, with a parameterization of the primary key of the source object.


setShouldVerifyDelete

public void setShouldVerifyDelete(boolean shouldVerifyDelete)
PUBLIC: Verify delete is used during delete and update on private 1:1's outside of a unit of work only. It checks for the previous value of the target object through joining the source and target tables. By default it is always done, but may be disabled for performance on distributed database reasons. In the unit of work the previous value is obtained from the backup-clone so it is never used.


setSourceToTargetKeyFieldAssociations

public void setSourceToTargetKeyFieldAssociations(java.util.Vector sourceToTargetKeyFieldAssociations)
INTERNAL: Set a collection of the source to target field associations.


setSourceToTargetKeyFields

public void setSourceToTargetKeyFields(java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> sourceToTargetKeyFields)
INTERNAL: Set the source keys to target keys fields association.


setTargetForeignKeyFieldName

public void setTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName)
PUBLIC: Define the target foreign key relationship in the 1-1 mapping. This method is used for singleton target foreign key relationships only, that is the target object's table has a foreign key field to the source object's primary key field. The target foreign key field name is specified. The distinction between a foreign key and target foreign key is that the 1-1 mapping will not populate the target foreign key value when written (because it is in the target table). Normally 1-1's are through foreign keys but in bi-directional 1-1's the back reference will be a target foreign key.


setTargetToSourceKeyFields

public void setTargetToSourceKeyFields(java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> targetToSourceKeyFields)
INTERNAL: Set the target keys to source keys fields association.


shouldVerifyDelete

public boolean shouldVerifyDelete()
PUBLIC: Verify delete is used during delete and update outside of a unit of work only. It checks for the previous value of the target object through joining the source and target tables.


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

writeFromAttributeIntoRow

public void writeFromAttributeIntoRow(java.lang.Object attribute,
                                      org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                      org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: A subclass should implement this method if it wants different behavior. Write the foreign key values from the attribute to the row.

Overrides:
writeFromAttributeIntoRow in class DatabaseMapping

valueFromObject

public java.lang.Object valueFromObject(java.lang.Object object,
                                        org.eclipse.persistence.internal.helper.DatabaseField field,
                                        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:
valueFromObject in class DatabaseMapping

valueFromRowInternalWithJoin

protected java.lang.Object valueFromRowInternalWithJoin(org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                                        org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                                        ObjectBuildingQuery sourceQuery,
                                                        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:
valueFromRowInternalWithJoin in class ForeignReferenceMapping
Throws:
DatabaseException

valueFromRowInternal

protected java.lang.Object valueFromRowInternal(org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                                org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                                ObjectBuildingQuery sourceQuery,
                                                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:
valueFromRowInternal in class ForeignReferenceMapping
Throws:
DatabaseException

writeFromObjectIntoRow

public void writeFromObjectIntoRow(java.lang.Object object,
                                   org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                   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

writeFromObjectIntoRowForShallowInsert

public void writeFromObjectIntoRowForShallowInsert(java.lang.Object object,
                                                   org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                                   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

writeFromObjectIntoRowWithChangeRecord

public void writeFromObjectIntoRowWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord,
                                                   org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                                   org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Get a value from the object and set that in the respective field of the row. Validation preventing primary key updates is implemented here.

Overrides:
writeFromObjectIntoRowWithChangeRecord in class DatabaseMapping

writeFromObjectIntoRowForShallowInsertWithChangeRecord

public void writeFromObjectIntoRowForShallowInsertWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord ChangeRecord,
                                                                   org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                                                   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 databaseRow,
                                     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