Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle TopLink API Reference 10g Release 3 (10.1.3) B13698-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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.lang.Cloneable, oracle.toplink.mappings.RelationalMapping, java.io.Serializable

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

Constructor Summary
`OneToOneMapping()` PUBLIC: Default constructor.

Method Summary
`void` | `addForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName, java.lang.String targetPrimaryKeyFieldName)` PUBLIC: Define the 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` | `buildSelectionCriteria()` This method would allow customers to get the potential selection criteria for a mapping prior to initialization.
`void` | `dontUseJoining()` PUBLIC: Indicates whether the referenced object should always be joined on read queries.
`java.util.Vector` | `getForeignKeyFieldNames()` PUBLIC: Return the foreign key field names associated with the mapping.
`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.
`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` | `setTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName)` PUBLIC: Define the target foreign key relationship in the 1-1 mapping.
`void` | `setUsesJoining(boolean usesJoining)` PUBLIC: Indicates whether the referenced object should always be joined on read queries.
`boolean` | `shouldUseJoining()` PUBLIC: Indicates whether the referenced object should always be joined on read queries.
`boolean` | `shouldVerifyDelete()` PUBLIC: Verify delete is used during delete and update outside of a unit of work only.
`void` | `useJoining()` PUBLIC: Indicates whether the referenced object should always be joined on read queries.

Methods inherited from class oracle.toplink.mappings.ObjectReferenceMapping
`useProxyIndirection, useProxyIndirection, useProxyIndirection`

Methods inherited from class oracle.toplink.mappings.ForeignReferenceMapping
`dontUseBatchReading, dontUseIndirection, getReferenceClass, getRelationshipPartnerAttributeName, isCascadeMerge, isCascadePersist, isCascadeRefresh, isCascadeRemove, privateOwnedRelationship, setCascadeAll, setCascadeMerge, setCascadePersist, setCascadeRefresh, setCascadeRemove, setCustomSelectionQuery, setIndirectionPolicy, setReferenceClass, setRelationshipPartnerAttributeName, setSelectionCall, setSelectionCriteria, setSelectionSQLString, setUsesBatchReading, setUsesIndirection, shouldUseBatchReading, useBasicIndirection, useBatchReading, useContainerIndirection, usesIndirection`

Methods inherited from class oracle.toplink.mappings.DatabaseMapping
`getAttributeAccessor, getAttributeClassification, getAttributeName, getGetMethodName, getReferenceClassDescriptor, getSetMethodName, isUsingMethodAccess, readOnly, readWrite, setAttributeAccessor, setAttributeName, setGetMethodName, setIsReadOnly, setSetMethodName, setWeight, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### OneToOneMapping

    public OneToOneMapping()

  PUBLIC: Default constructor.

Method Detail

### 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.

### 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.

### dontUseJoining

    public void dontUseJoining()

  PUBLIC: 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()

  PUBLIC: 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)

  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.

### 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.

### 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.

### setUsesJoining

    public void setUsesJoining(boolean usesJoining)

  PUBLIC: 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()

  PUBLIC: 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()

  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.

### useJoining

    public void useJoining()

  PUBLIC: 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.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 1998, 2006, Oracle. All Rights Reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD