oracle.toplink.mappings
Class OneToOneMapping
java.lang.Object
oracle.toplink.mappings.DatabaseMapping
oracle.toplink.mappings.ForeignReferenceMapping
oracle.toplink.mappings.ObjectReferenceMapping
oracle.toplink.mappings.OneToOneMapping
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, oracle.toplink.mappings.RelationalMapping
public class OneToOneMapping
- extends ObjectReferenceMapping
- implements oracle.toplink.mappings.RelationalMapping
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.
- Since:
- TOPLink/Java 1.0
- See Also:
- Serialized Form
Method Summary |
void |
addForeignKeyField(DatabaseField sourceForeignKeyField,
DatabaseField targetPrimaryKeyField)
Define the foreign key relationship in the 1-1 mapping. |
void |
addForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName,
java.lang.String targetPrimaryKeyFieldName)
Define the foreign key relationship in the 1-1 mapping. |
void |
addTargetForeignKeyField(DatabaseField targetForeignKeyField,
DatabaseField sourcePrimaryKeyField)
Define the target foreign key relationship in the 1-1 mapping. |
void |
addTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName,
java.lang.String sourcePrimaryKeyFieldName)
Define the target foreign key relationship in the 1-1 mapping. |
Expression |
buildSelectionCriteria()
This method would allow customers to get the potential selection criteria for a mapping
prior to initialization. |
void |
dontUseJoining()
Deprecated. since OracleAS TopLink 11g (11.1.1.0.0). This class is replaced by
oracle.toplink.mappings.ForeignReferenceMapping.setJoinFetch(int) |
java.util.Vector |
getForeignKeyFieldNames()
Return the foreign key field names associated with the mapping. |
void |
setForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName)
Define the foreign key relationship in the 1-1 mapping. |
void |
setForeignKeyFieldNames(java.util.Vector fieldNames)
Return the foreign key field names associated with the mapping. |
void |
setShouldVerifyDelete(boolean shouldVerifyDelete)
Verify delete is used during delete and update on private 1:1's outside of a unit of work only. |
void |
setTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName)
Define the target foreign key relationship in the 1-1 mapping. |
void |
setUsesJoining(boolean usesJoining)
Deprecated. since OracleAS TopLink 11g (11.1.1.0.0). This class is replaced by
oracle.toplink.mappings.ForeignReferenceMapping.setJoinFetch(int) |
boolean |
shouldUseJoining()
Deprecated. since OracleAS TopLink 11g (11.1.1.0.0). This class is replaced by
oracle.toplink.mappings.ForeignReferenceMapping.getJoinFetch() |
boolean |
shouldVerifyDelete()
Verify delete is used during delete and update outside of a unit of work only. |
void |
useJoining()
Deprecated. since OracleAS TopLink 11g (11.1.1.0.0). This class is replaced by
oracle.toplink.mappings.ForeignReferenceMapping.setJoinFetch(int) |
Methods inherited from class oracle.toplink.mappings.ForeignReferenceMapping |
dontUseBatchReading, dontUseIndirection, getJoinFetch, getReferenceClass, getRelationshipPartnerAttributeName, isCascadeMerge, isCascadePersist, isCascadeRefresh, isCascadeRemove, isInnerJoinFetched, isJoinFetched, isOuterJoinFetched, isPrivateOwned, privateOwnedRelationship, setCascadeAll, setCascadeMerge, setCascadePersist, setCascadeRefresh, setCascadeRemove, setCustomSelectionQuery, setIndirectionPolicy, setIsPrivateOwned, setJoinFetch, setReferenceClass, setRelationshipPartnerAttributeName, setSelectionCall, setSelectionCriteria, setSelectionSQLString, setUsesBatchReading, setUsesIndirection, shouldUseBatchReading, useBasicIndirection, useBatchReading, useContainerIndirection, useInnerJoinFetch, useOuterJoinFetch, usesIndirection |
Methods inherited from class oracle.toplink.mappings.DatabaseMapping |
getAttributeAccessor, getAttributeClassification, getAttributeName, getGetMethodName, getProperty, getSetMethodName, isLazy, isOptional, isUsingMethodAccess, readOnly, readWrite, setAttributeAccessor, setAttributeName, setGetMethodName, setIsLazy, setIsOptional, setIsReadOnly, setProperty, setSetMethodName, setWeight, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
OneToOneMapping
public OneToOneMapping()
- Default constructor.
addForeignKeyField
public void addForeignKeyField(DatabaseField sourceForeignKeyField,
DatabaseField targetPrimaryKeyField)
- 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)
- 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(DatabaseField targetForeignKeyField,
DatabaseField sourcePrimaryKeyField)
- 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)
- 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.
dontUseJoining
public void dontUseJoining()
- Deprecated. since OracleAS TopLink 11g (11.1.1.0.0). This class is replaced by
oracle.toplink.mappings.ForeignReferenceMapping.setJoinFetch(int)
- Indicates whether the referenced object should always be joined on read queries.
Joining will join the two classes tables to read all of the data in a single query.
This should only be used if it is know that the related objects are always required with the source object, or indirection is not used.
getForeignKeyFieldNames
public java.util.Vector getForeignKeyFieldNames()
- Return the foreign key field names associated with the mapping.
These are only the source fields that are writable.
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
setForeignKeyFieldName
public void setForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName)
- 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)
- Return the foreign key field names associated with the mapping.
These are only the source fields that are writable.
setShouldVerifyDelete
public void setShouldVerifyDelete(boolean shouldVerifyDelete)
- 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.
setTargetForeignKeyFieldName
public void setTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName)
- 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.
setUsesJoining
public void setUsesJoining(boolean usesJoining)
- Deprecated. since OracleAS TopLink 11g (11.1.1.0.0). This class is replaced by
oracle.toplink.mappings.ForeignReferenceMapping.setJoinFetch(int)
- Indicates whether the referenced object should always be joined on read queries.
Joining will join the two classes tables to read all of the data in a single query.
This should only be used if it is know that the related objects are always required with the source object, or indirection is not used.
shouldUseJoining
public boolean shouldUseJoining()
- Deprecated. since OracleAS TopLink 11g (11.1.1.0.0). This class is replaced by
oracle.toplink.mappings.ForeignReferenceMapping.getJoinFetch()
- Indicates whether the referenced object should always be joined on read queries.
Joining will join the two classes tables to read all of the data in a single query.
This should only be used if it is know that the related objects are always required with the source object, or indirection is not used.
shouldVerifyDelete
public boolean shouldVerifyDelete()
- 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.
useJoining
public void useJoining()
- Deprecated. since OracleAS TopLink 11g (11.1.1.0.0). This class is replaced by
oracle.toplink.mappings.ForeignReferenceMapping.setJoinFetch(int)
- Indicates whether the referenced object should always be joined on read queries.
Joining will join the two classes tables to read all of the data in a single query.
This should only be used if it is know that the related objects are always required with the source object, or indirection is not used.