EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference

org.eclipse.persistence.eis.mappings
Class EISOneToOneMapping

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.eis.mappings.EISOneToOneMapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, EISMapping

public class EISOneToOneMapping
extends ObjectReferenceMapping
implements EISMapping

An EIS one-to-one mapping is a reference mapping that represents the relationship between a single source object and a single mapped persistent Java object. The source object usually contains a foreign key (pointer) to the target object (key on source); alternatively, the target object may contiain a foreign key to the source object (key on target). Because both the source and target objects use interactions, they must both be configured as root object types.

Record Type Description
Indexed Ordered collection of record elements. The indexed record EIS format enables Java class attribute values to be retreived by position or index.
Mapped Key-value map based representation of record elements. The mapped record EIS format enables Java class attribute values to be retreived by an object key.
XML Record/Map representation of an XML DOM element.

See Also:
EISDescriptor.useIndexedRecordFormat(), EISDescriptor.useMappedRecordFormat(), EISDescriptor.useXMLRecordFormat(), Serialized Form
Since:
Oracle TopLink 10g Release 2 (10.1.3)

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 sourceToTargetKeyFields
          Maps the source foreign/primary key fields to the target primary/foreign key fields.
protected  java.util.Map 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
EISOneToOneMapping()
           
 
Method Summary
 void addAscendingOrdering(java.lang.String queryKeyName)
          INTERNAL: This method is not supported in an EIS environment.
 void addDescendingOrdering(java.lang.String queryKeyName)
          INTERNAL: This method is not supported in an EIS environment.
 void addForeignKeyField(org.eclipse.persistence.internal.helper.DatabaseField sourceForeignKeyField, org.eclipse.persistence.internal.helper.DatabaseField targetKeyField)
          PUBLIC: Define the source foreign key relationship in the one-to-one mapping.
 void addForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName, java.lang.String targetKeyFieldName)
          PUBLIC: Define the source foreign key relationship in the one-to-one mapping.
 java.lang.Object clone()
          INTERNAL: This methods clones all the fields and ensures that each collection refers to the same clones.
 void dontUseBatchReading()
          INTERNAL: This method is not supported in an EIS environment.
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.Class getFieldClassification(org.eclipse.persistence.internal.helper.DatabaseField fieldToClassify)
          INTERNAL: Return the classifiction for the field contained in the mapping.
 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.Map getSourceToTargetKeyFields()
          INTERNAL: Gets the foreign key fields.
 java.util.Map getTargetToSourceKeyFields()
          INTERNAL: Gets the target foreign key fields.
 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 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 isEISMapping()
          INTERNAL:
 boolean isOneToOneMapping()
          INTERNAL:
protected  java.lang.Object readPrivateOwnedForObject(ObjectLevelModifyQuery modifyQuery)
          INTERNAL: Reads the private owned object.
protected  void setPrivateOwnedCriteria(Expression expression)
          INTERNAL: Private owned criteria is used to verify the deletion of the target.
 void setSelectionSQLString(java.lang.String sqlString)
          INTERNAL: This method is not supported in an EIS environment.
 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 setSourceToTargetKeyFields(java.util.Map sourceToTargetKeyFields)
          INTERNAL: Set the source keys to target keys fields association.
 void setTargetToSourceKeyFields(java.util.Map targetToSourceKeyFields)
          INTERNAL: Set the source keys to target keys fields association.
 void setUsesBatchReading(boolean usesBatchReading)
          INTERNAL: This method is not supported in an EIS environment.
 boolean shouldUseBatchReading()
          INTERNAL: This method is not supported in an EIS environment.
 boolean shouldVerifyDelete()
          PUBLIC: Verify delete is used during delete and update outside of a unit of work only.
 void useBatchReading()
          INTERNAL: This method is not supported in an EIS environment.
 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 session)
          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.
 
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, dontUseIndirection, extractResultFromBatchQuery, 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, 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, setReferenceClass, setReferenceClassName, setReferenceDescriptor, setRelationshipPartner, setRelationshipPartnerAttributeName, setRequiresTransientWeavedFields, setSelectionCall, setSelectionCriteria, setSelectionQuery, setTempSession, setUsesIndirection, shouldForceInitializationOfSelectionCriteria, shouldInitializeSelectionCriteria, shouldMergeCascadeParts, shouldMergeCascadeReference, shouldObjectModifyCascadeToParts, shouldUseValueFromRowWithJoin, trimRowForJoin, trimRowForJoin, useBasicIndirection, 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, getField, 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, isManyToManyMapping, isNestedTableMapping, isOneToManyMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isReferenceMapping, 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, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowWithChangeRecord, writeInsertFieldsIntoRow, writeUpdateFieldsIntoRow
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sourceToTargetKeyFields

protected java.util.Map sourceToTargetKeyFields
Maps the source foreign/primary key fields to the target primary/foreign key fields.


targetToSourceKeyFields

protected java.util.Map 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

EISOneToOneMapping

public EISOneToOneMapping()
Method Detail

isEISMapping

public boolean isEISMapping()
INTERNAL:

Overrides:
isEISMapping in class DatabaseMapping

isOneToOneMapping

public boolean isOneToOneMapping()
INTERNAL:

Overrides:
isOneToOneMapping in class DatabaseMapping

addForeignKeyField

public void addForeignKeyField(org.eclipse.persistence.internal.helper.DatabaseField sourceForeignKeyField,
                               org.eclipse.persistence.internal.helper.DatabaseField targetKeyField)
PUBLIC: Define the source foreign key relationship in the one-to-one mapping. This method is used to add foreign key relationships to the mapping. Both the source foreign key field name and the corresponding target primary key field name must be specified.


addForeignKeyFieldName

public void addForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName,
                                   java.lang.String targetKeyFieldName)
PUBLIC: Define the source foreign key relationship in the one-to-one mapping. This method is used to add foreign key relationships to the mapping. Both the source foreign key field name and the corresponding target primary key field name must be specified.


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

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.


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


readPrivateOwnedForObject

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

Overrides:
readPrivateOwnedForObject in class ObjectReferenceMapping
Throws:
DatabaseException

initializePrivateOwnedCriteria

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


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 session)
                              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

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

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.


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.


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.


getSourceToTargetKeyFields

public java.util.Map getSourceToTargetKeyFields()
INTERNAL: Gets the foreign key fields.


getTargetToSourceKeyFields

public java.util.Map getTargetToSourceKeyFields()
INTERNAL: Gets the target foreign key fields.


setSourceToTargetKeyFields

public void setSourceToTargetKeyFields(java.util.Map sourceToTargetKeyFields)
INTERNAL: Set the source keys to target keys fields association.


setTargetToSourceKeyFields

public void setTargetToSourceKeyFields(java.util.Map targetToSourceKeyFields)
INTERNAL: Set the source keys to target keys fields association.


setSelectionSQLString

public void setSelectionSQLString(java.lang.String sqlString)
INTERNAL: This method is not supported in an EIS environment.

Overrides:
setSelectionSQLString in class ForeignReferenceMapping

setUsesBatchReading

public void setUsesBatchReading(boolean usesBatchReading)
INTERNAL: This method is not supported in an EIS environment.

Overrides:
setUsesBatchReading in class ForeignReferenceMapping

shouldUseBatchReading

public boolean shouldUseBatchReading()
INTERNAL: This method is not supported in an EIS environment.

Overrides:
shouldUseBatchReading in class ForeignReferenceMapping

useBatchReading

public void useBatchReading()
INTERNAL: This method is not supported in an EIS environment.

Overrides:
useBatchReading in class ForeignReferenceMapping

dontUseBatchReading

public void dontUseBatchReading()
INTERNAL: This method is not supported in an EIS environment.

Overrides:
dontUseBatchReading in class ForeignReferenceMapping

addAscendingOrdering

public void addAscendingOrdering(java.lang.String queryKeyName)
INTERNAL: This method is not supported in an EIS environment.


addDescendingOrdering

public void addDescendingOrdering(java.lang.String queryKeyName)
INTERNAL: This method is not supported in an EIS environment.


EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference