Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

B32476-03

oracle.toplink.mappings
Class ForeignReferenceMapping

java.lang.Object
  extended by oracle.toplink.mappings.DatabaseMapping
      extended by oracle.toplink.mappings.ForeignReferenceMapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
CollectionMapping, ObjectReferenceMapping

public abstract class ForeignReferenceMapping
extends DatabaseMapping

Purpose: Abstract class for relationship mappings
11/26/2008 - 11.1.1.1.0 Michael O'Brien - 7596027: Remove TopLink JPA provider which is replaced by org.eclipse.persistence.jpa.PersistenceProvider

See Also:
Serialized Form

Field Summary
static int INNER_JOIN
          Specify any INNER join on a join fetch.
static int NONE
          Specify no join fetch, this is the default.
static int OUTER_JOIN
          Specify any OUTER join on a join fetch.
 
Method Summary
 void dontUseBatchReading()
          Indicates whether the referenced object should always be batch read on read all queries.
 void dontUseIndirection()
          Indirection means that a ValueHolder will be put in-between the attribute and the real object.
 int getJoinFetch()
          Return if this relationship should always be join fetched.
 java.lang.Class getReferenceClass()
          Returns the reference class.
 java.lang.String getRelationshipPartnerAttributeName()
          Use this method retreive the relationship partner attribute name of this bidirectional Mapping.
 boolean isCascadeMerge()
          Check cascading value for the MERGE operation.
 boolean isCascadePersist()
          Check cascading value for the CREATE operation.
 boolean isCascadeRefresh()
          Check cascading value for the REFRESH operation.
 boolean isCascadeRemove()
          Check cascading value for the REMOVE operation.
 boolean isInnerJoinFetched()
          Return if this relationship should always be INNER join fetched.
 boolean isJoinFetched()
          Return if this relationship should always be join fetched.
 boolean isOuterJoinFetched()
          Return if this relationship should always be OUTER join fetched.
 boolean isPrivateOwned()
          Return true if referenced objects are privately owned else false.
 void privateOwnedRelationship()
          Sets the reference object to be a private owned.
 void setCascadeAll(boolean value)
          Sets the cascading for all JPA operations.
 void setCascadeMerge(boolean value)
          Sets the cascading for the JPA MERGE operation.
 void setCascadePersist(boolean value)
          Sets the cascading for the JPA CREATE operation.
 void setCascadeRefresh(boolean value)
          Sets the cascading for the JPA REFRESH operation.
 void setCascadeRemove(boolean value)
          Sets the cascading for the JPA REMOVE operation.
 void setCustomSelectionQuery(ReadQuery query)
          Relationship mappings creates a read query to read reference objects.
 void setIndirectionPolicy(oracle.toplink.internal.indirection.IndirectionPolicy indirectionPolicy)
          ADVANCED: Set the indirection policy.
 void setIsPrivateOwned(boolean isPrivateOwned)
          Set if the relationship is privately owned.
 void setJoinFetch(int joinFetch)
          Indicates whether the referenced object(s) should always be joined on read queries.
 void setReferenceClass(java.lang.Class referenceClass)
          Set the referenced class.
 void setRelationshipPartnerAttributeName(java.lang.String attributeName)
          Use this method to specify the relationship partner attribute name of a bidirectional Mapping.
 void setSelectionCall(Call call)
          This is a property on the mapping which will allow custom call to be substituted for reading a reference object.
 void setSelectionCriteria(Expression anExpression)
          Sets the selection criteria to be used as a where clause to read reference objects.
 void setSelectionSQLString(java.lang.String sqlString)
          This is a property on the mapping which will allow custom SQL to be substituted for reading a reference object.
 void setUsesBatchReading(boolean usesBatchReading)
          Indicates whether the referenced object should always be batch read on read all queries.
 void setUsesIndirection(boolean usesIndirection)
          Indirection means that a ValueHolder will be put in-between the attribute and the real object.
 boolean shouldUseBatchReading()
          Indicates whether the referenced object should always be batch read on read all queries.
 void useBasicIndirection()
          Indirection means that a ValueHolder will be put in-between the attribute and the real object.
 void useBatchReading()
          Indicates whether the referenced object should always be batch read on read all queries.
 void useContainerIndirection(java.lang.Class containerClass)
          Indirection means that a IndirectContainer (wrapping a ValueHolder) will be put in-between the attribute and the real object.
 void useInnerJoinFetch()
          Specify this relationship to always be join fetched using an INNER join.
 void useOuterJoinFetch()
          Specify this relationship to always be join fetched using an OUTER join.
 boolean usesIndirection()
          Indirection means that some sort of indirection object will be put in-between the attribute and the real object.
 
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
 

Field Detail

INNER_JOIN

public static final int INNER_JOIN
Description copied from class: ForeignReferenceMapping
Specify any INNER join on a join fetch.

See Also:
Constant Field Values

OUTER_JOIN

public static final int OUTER_JOIN
Description copied from class: ForeignReferenceMapping
Specify any OUTER join on a join fetch.

See Also:
Constant Field Values

NONE

public static final int NONE
Description copied from class: ForeignReferenceMapping
Specify no join fetch, this is the default.

See Also:
Constant Field Values
Method Detail

dontUseBatchReading

public void dontUseBatchReading()
Indicates whether the referenced object should always be batch read on read all queries. Batch reading will read all of the related objects in a single query when accessed from an originating read all. 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.


dontUseIndirection

public void dontUseIndirection()
Indirection means that a ValueHolder will be put in-between the attribute and the real object. This allows for the reading of the target from the database to be delayed until accessed. This defaults to true and is strongly suggested as it give a huge performance gain.


getReferenceClass

public java.lang.Class getReferenceClass()
Returns the reference class.


getRelationshipPartnerAttributeName

public java.lang.String getRelationshipPartnerAttributeName()
Use this method retreive the relationship partner attribute name of this bidirectional Mapping.


isCascadePersist

public boolean isCascadePersist()
Check cascading value for the CREATE operation.


isCascadeMerge

public boolean isCascadeMerge()
Check cascading value for the MERGE operation.


isCascadeRefresh

public boolean isCascadeRefresh()
Check cascading value for the REFRESH operation.


isCascadeRemove

public boolean isCascadeRemove()
Check cascading value for the REMOVE operation.


isPrivateOwned

public boolean isPrivateOwned()
Return true if referenced objects are privately owned else false.

Overrides:
isPrivateOwned in class DatabaseMapping

privateOwnedRelationship

public void privateOwnedRelationship()
Sets the reference object to be a private owned. The default behaviour is non private owned, or independent.

See Also:
setIsPrivateOwned(boolean)

setCascadeAll

public void setCascadeAll(boolean value)
Sets the cascading for all JPA operations.


setCascadePersist

public void setCascadePersist(boolean value)
Sets the cascading for the JPA CREATE operation.


setCascadeMerge

public void setCascadeMerge(boolean value)
Sets the cascading for the JPA MERGE operation.


setCascadeRefresh

public void setCascadeRefresh(boolean value)
Sets the cascading for the JPA REFRESH operation.


setCascadeRemove

public void setCascadeRemove(boolean value)
Sets the cascading for the JPA REMOVE operation.


setCustomSelectionQuery

public void setCustomSelectionQuery(ReadQuery query)
Relationship mappings creates a read query to read reference objects. If this default query needs to be customize then user can specify its own read query to do the reading of reference objects. One must instance of ReadQuery or subclasses of the ReadQuery.


setIndirectionPolicy

public void setIndirectionPolicy(oracle.toplink.internal.indirection.IndirectionPolicy indirectionPolicy)
ADVANCED: Set the indirection policy.


setIsPrivateOwned

public void setIsPrivateOwned(boolean isPrivateOwned)
Set if the relationship is privately owned. A privately owned relationship means the target object is a dependent part of the source object and is not referenced by any other object and cannot exist on its own. Private ownership causes many operations to be cascaded across the relationship, including, deletion, insertion, refreshing, locking (when cascaded). It also ensures that private objects removed from collections are deleted and object added are inserted.


setReferenceClass

public void setReferenceClass(java.lang.Class referenceClass)
Set the referenced class.


setRelationshipPartnerAttributeName

public void setRelationshipPartnerAttributeName(java.lang.String attributeName)
Use this method to specify the relationship partner attribute name of a bidirectional Mapping. TopLink will use the attribute name to find the back pointer mapping to maintain referential integrity of the bi-directional mappings.


setSelectionCriteria

public void setSelectionCriteria(Expression anExpression)
Sets the selection criteria to be used as a where clause to read reference objects. This criteria is automatically generated by the TopLink if not explicitly specified by the user.


setSelectionSQLString

public void setSelectionSQLString(java.lang.String sqlString)
This is a property on the mapping which will allow custom SQL to be substituted for reading a reference object.


setSelectionCall

public void setSelectionCall(Call call)
This is a property on the mapping which will allow custom call to be substituted for reading a reference object.


setUsesBatchReading

public void setUsesBatchReading(boolean usesBatchReading)
Indicates whether the referenced object should always be batch read on read all queries. Batch reading will read all of the related objects in a single query when accessed from an originating read all. 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.


setUsesIndirection

public void setUsesIndirection(boolean usesIndirection)
Indirection means that a ValueHolder will be put in-between the attribute and the real object. This allows for the reading of the target from the database to be delayed until accessed. This defaults to true and is strongly suggested as it give a huge performance gain.

See Also:
useBasicIndirection(), dontUseIndirection()

shouldUseBatchReading

public boolean shouldUseBatchReading()
Indicates whether the referenced object should always be batch read on read all queries. Batch reading will read all of the related objects in a single query when accessed from an originating read all. 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.


useBasicIndirection

public void useBasicIndirection()
Indirection means that a ValueHolder will be put in-between the attribute and the real object. This allows for the reading of the target from the database to be delayed until accessed. This defaults to true and is strongly suggested as it give a huge performance gain.


useBatchReading

public void useBatchReading()
Indicates whether the referenced object should always be batch read on read all queries. Batch reading will read all of the related objects in a single query when accessed from an originating read all. 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.


useContainerIndirection

public void useContainerIndirection(java.lang.Class containerClass)
Indirection means that a IndirectContainer (wrapping a ValueHolder) will be put in-between the attribute and the real object. This allows for an application specific class to be used which wraps the value holder. The purpose of this is that the domain objects will not require to import the ValueHolderInterface class. Refer also to transparent indirection for a transparent solution to indirection.


usesIndirection

public boolean usesIndirection()
Indirection means that some sort of indirection object will be put in-between the attribute and the real object. This allows for the reading of the target from the database to be delayed until accessed. This defaults to true and is strongly suggested as it give a huge performance gain.


setJoinFetch

public void setJoinFetch(int joinFetch)
Indicates whether the referenced object(s) 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. A join-fetch can either use an INNER_JOIN or OUTER_JOIN, if the relationship may reference null or an empty collection an outer join should be used to avoid filtering the source objects from the queries. Join fetch can also be specified on the query, and it is normally more efficient to do so as some queries may not require the related objects. Typically batch reading is more efficient than join fetching and should be considered, especially for collection relationships.

See Also:
ObjectLevelReadQuery.addJoinedAttribute(String), ReadAllQuery.addBatchReadAttribute(String)

getJoinFetch

public int getJoinFetch()
Return if this relationship should always be join fetched.


isJoinFetched

public boolean isJoinFetched()
Return if this relationship should always be join fetched.


isInnerJoinFetched

public boolean isInnerJoinFetched()
Return if this relationship should always be INNER join fetched.


isOuterJoinFetched

public boolean isOuterJoinFetched()
Return if this relationship should always be OUTER join fetched.


useInnerJoinFetch

public void useInnerJoinFetch()
Specify this relationship to always be join fetched using an INNER join.


useOuterJoinFetch

public void useOuterJoinFetch()
Specify this relationship to always be join fetched using an OUTER join.


Copyright © 1998, 2010, Oracle. All Rights Reserved.