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

public Class EISOneToOneMapping

extends ObjectReferenceMapping
implements EISMapping
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.eis.mappings.EISMapping
Imports
java.util.Enumeration, .HashMap, .Iterator, .List, .Map, org.eclipse.persistence.annotations.CacheKeyType, org.eclipse.persistence.exceptions.DatabaseException, .DescriptorException, org.eclipse.persistence.expressions.Expression, .ExpressionBuilder, org.eclipse.persistence.indirection.ValueHolder, org.eclipse.persistence.internal.helper.DatabaseField, org.eclipse.persistence.internal.identitymaps.CacheId, .CacheKey, org.eclipse.persistence.internal.queries.JoinedAttributeManager, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, org.eclipse.persistence.mappings.DatabaseMapping, .ObjectReferenceMapping, org.eclipse.persistence.queries.ObjectBuildingQuery, .ObjectLevelModifyQuery, .ObjectLevelReadQuery, .ReadObjectQuery, .ReadQuery

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 contain 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 formats
Record Type Description
Indexed Ordered collection of record elements. The indexed record EIS format enables Java class attribute values to be retrieved 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 retrieved by an object key.
XML Record/Map representation of an XML DOM element.
Since
Oracle TopLink 10g Release 2 (10.1.3)
See Also
org.eclipse.persistence.eis.EISDescriptor#useIndexedRecordFormat, org.eclipse.persistence.eis.EISDescriptor#useMappedRecordFormat, org.eclipse.persistence.eis.EISDescriptor#useXMLRecordFormat

Field Summary

Modifier and TypeField and Description
protected transient Expression
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 Map<DatabaseField, DatabaseField>
sourceToTargetKeyFields

Maps the source foreign/primary key fields to the target primary/foreign key fields.

protected Map<DatabaseField, DatabaseField>
targetToSourceKeyFields

Maps the target primary/foreign key fields to the source foreign/primary key fields.

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

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addForeignKeyField(DatabaseField sourceForeignKeyField, DatabaseField targetKeyField)

Overrides org.eclipse.persistence.mappings.ForeignReferenceMapping.addForeignKeyField.

PUBLIC: Define the source foreign key relationship in the one-to-one mapping.
public void
addForeignKeyFieldName(String sourceForeignKeyFieldName, String targetKeyFieldName)

PUBLIC: Define the source foreign key relationship in the one-to-one mapping.

public Object
clone()

Overrides org.eclipse.persistence.mappings.ForeignReferenceMapping.clone.

INTERNAL: This methods clones all the fields and ensures that each collection refers to the same clones.
public Object
extractPrimaryKeysForReferenceObjectFromRow(AbstractRecord row)

Overrides org.eclipse.persistence.mappings.ObjectReferenceMapping.extractPrimaryKeysForReferenceObjectFromRow.

INTERNAL: Return the primary key for the reference object (i.e. the object object referenced by domainObject and specified by mapping).
public Class<?>
getFieldClassification(DatabaseField fieldToClassify)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.getFieldClassification.

INTERNAL: Return the classifiction for the field contained in the mapping.
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.

public Map<DatabaseField, DatabaseField>

Returns:

The mapping from source to target key fields
getSourceToTargetKeyFields
()

INTERNAL: Gets the foreign key fields.

public Map<DatabaseField, DatabaseField>

Returns:

The mapping from target to source key fields
getTargetToSourceKeyFields
()

INTERNAL: Gets the target foreign key fields.

public void
protected void
initializeForeignKeys(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(AbstractSession session)

INTERNAL: Selection criteria is created with source foreign keys and target keys.

public boolean
public boolean
protected Object
protected void
setPrivateOwnedCriteria(Expression expression)

INTERNAL: Private owned criteria is used to verify the deletion of the target.

public void
setSelectionSQLString(String sqlString)

Overrides org.eclipse.persistence.mappings.ForeignReferenceMapping.setSelectionSQLString.

INTERNAL: This method is not supported in an EIS environment.
public void
setShouldVerifyDelete(boolean
Sets whether delete verification should be performed
shouldVerifyDelete
)

PUBLIC: Verify delete is used during delete and update on private 1:1's outside of a unit of work only.

public void
setSourceToTargetKeyFields(Map<DatabaseField, DatabaseField>
The mapping from source keys to target keys
sourceToTargetKeyFields
)

INTERNAL: Set the source keys to target keys fields association.

public void
setTargetToSourceKeyFields(Map<DatabaseField, DatabaseField>
The mapping from target keys to source keys
targetToSourceKeyFields
)

INTERNAL: Set the target keys to source keys fields association.

public boolean

Returns:

TRUE if verify delete has been enabled
shouldVerifyDelete
()

PUBLIC: Verify delete is used during delete and update outside of a unit of work only.

public Object
valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, CacheKey cacheKey, AbstractSession session, 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.
Inherited from org.eclipse.persistence.mappings.ObjectReferenceMapping:
buildBackupCloneForPartObjectbuildChangeRecordbuildCloneForPartObjectbuildCopybuildExpressionbuildReferencesPKListbuildTargetInterfacesbuildUnitofWorkCloneForPartObjectcascadeDiscoverAndPersistUnregisteredNewObjectscascadeDiscoverAndPersistUnregisteredNewObjectscascadePerformRemoveIfRequiredcascadePerformRemoveIfRequiredcascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequiredcascadeRegisterNewIfRequiredcascadeRegisterNewIfRequiredcollectFieldscollectQueryParameterscompareForChangecompareObjectsWithoutPrivateOwnedcompareObjectsWithPrivateOwnedcreateCloneValueHolderearlyPreDeleteextractPrimaryKeyRowForSourceObjectextractPrimaryKeysForReferenceObjectextractPrimaryKeysFromRealReferenceObjectfixRealObjectReferencesgetDescriptorForTargetgetForeignKeyFieldsgetPrimaryKeyForObjectgetRealAttributeValueFromAttributehasConstraintDependencyhasRelationTableMechanisminsertinternalBuildChangeRecordisChangeTrackingSupportedisForeignKeyRelationshipisObjectReferenceMappingiterateOnRealAttributeValueloadAllmergeChangesIntoObjectmergeIntoObjectpostCalculateChangespostDeletepostInsertpostUpdatepreDeletepreInitializepreInsertpreUpdaterecordPrivateOwnedRemovalssetForeignKeyFieldssetIsForeignKeyRelationshipsetNewValueInChangeRecordupdateupdateChangeRecordupdateChangeRecordForSelfMergeuseProxyIndirectionuseProxyIndirectionuseProxyIndirectionvalueFromPKListverifyDeletewriteFromObjectIntoRowForUpdatewriteFromObjectIntoRowForWhereClause

Field Detail

privateOwnedCriteriaback to summary
protected transient Expression privateOwnedCriteria
shouldVerifyDeleteback to summary
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.

sourceToTargetKeyFieldsback to summary
protected Map<DatabaseField, DatabaseField> sourceToTargetKeyFields

Maps the source foreign/primary key fields to the target primary/foreign key fields.

targetToSourceKeyFieldsback to summary
protected Map<DatabaseField, DatabaseField> targetToSourceKeyFields

Maps the target primary/foreign key fields to the source foreign/primary key fields.

Constructor Detail

EISOneToOneMappingback to summary
public EISOneToOneMapping()

Method Detail

addForeignKeyFieldback to summary
public void addForeignKeyField(DatabaseField sourceForeignKeyField, DatabaseField targetKeyField)

Overrides org.eclipse.persistence.mappings.ForeignReferenceMapping.addForeignKeyField.

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.

Annotations
@Override
addForeignKeyFieldNameback to summary
public void addForeignKeyFieldName(String sourceForeignKeyFieldName, 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.

cloneback to summary
public Object clone()

Overrides org.eclipse.persistence.mappings.ForeignReferenceMapping.clone.

INTERNAL: This methods clones all the fields and ensures that each collection refers to the same clones.

Returns:Object

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

new instance of itself

Annotations
@Override
extractPrimaryKeysForReferenceObjectFromRowback to summary
public Object extractPrimaryKeysForReferenceObjectFromRow(AbstractRecord row)

Overrides org.eclipse.persistence.mappings.ObjectReferenceMapping.extractPrimaryKeysForReferenceObjectFromRow.

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.

Annotations
@Override
getFieldClassificationback to summary
public Class<?> getFieldClassification(DatabaseField fieldToClassify) throws DescriptorException

Overrides org.eclipse.persistence.mappings.DatabaseMapping.getFieldClassification.

INTERNAL: Return the classifiction for the field contained in the mapping. This is used to convert the row value to a consistent java value.

Annotations
@Override
getPrivateOwnedCriteriaback to summary
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.

getSourceToTargetKeyFieldsback to summary
public Map<DatabaseField, DatabaseField> getSourceToTargetKeyFields()

INTERNAL: Gets the foreign key fields.

Returns:Map<DatabaseField, DatabaseField>

The mapping from source to target key fields

getTargetToSourceKeyFieldsback to summary
public Map<DatabaseField, DatabaseField> getTargetToSourceKeyFields()

INTERNAL: Gets the target foreign key fields.

Returns:Map<DatabaseField, DatabaseField>

The mapping from target to source key fields

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

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

INTERNAL: Initialize the mapping.

Annotations
@Override
initializeForeignKeysback to summary
protected void initializeForeignKeys(AbstractSession session)

INTERNAL: The foreign keys primary keys are stored as database fields in the hashtable.

initializePrivateOwnedCriteriaback to summary
protected void initializePrivateOwnedCriteria()

INTERNAL: Selection criteria is created with source foreign keys and target keys.

initializeSelectionCriteriaback to summary
protected void initializeSelectionCriteria(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

isEISMappingback to summary
public boolean isEISMapping()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.isEISMapping.

INTERNAL:

Annotations
@Override
isOneToOneMappingback to summary
public boolean isOneToOneMapping()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.isOneToOneMapping.

INTERNAL:

Annotations
@Override
readPrivateOwnedForObjectback to summary
protected Object readPrivateOwnedForObject(ObjectLevelModifyQuery modifyQuery) throws DatabaseException

Overrides org.eclipse.persistence.mappings.ObjectReferenceMapping.readPrivateOwnedForObject.

INTERNAL: Reads the private owned object.

Annotations
@Override
setPrivateOwnedCriteriaback to summary
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.

setSelectionSQLStringback to summary
public void setSelectionSQLString(String sqlString)

Overrides org.eclipse.persistence.mappings.ForeignReferenceMapping.setSelectionSQLString.

INTERNAL: This method is not supported in an EIS environment.

Annotations
@Override
setShouldVerifyDeleteback to summary
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.

Parameters
shouldVerifyDelete:boolean

Sets whether delete verification should be performed

setSourceToTargetKeyFieldsback to summary
public void setSourceToTargetKeyFields(Map<DatabaseField, DatabaseField> sourceToTargetKeyFields)

INTERNAL: Set the source keys to target keys fields association.

Parameters
sourceToTargetKeyFields:Map<DatabaseField, DatabaseField>

The mapping from source keys to target keys

setTargetToSourceKeyFieldsback to summary
public void setTargetToSourceKeyFields(Map<DatabaseField, DatabaseField> targetToSourceKeyFields)

INTERNAL: Set the target keys to source keys fields association.

Parameters
targetToSourceKeyFields:Map<DatabaseField, DatabaseField>

The mapping from target keys to source keys

shouldVerifyDeleteback to summary
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.

Returns:boolean

TRUE if verify delete has been enabled

valueFromRowback to summary
public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, CacheKey cacheKey, AbstractSession session, 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