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

B32476-03

oracle.toplink.mappings
Class DatabaseMapping

java.lang.Object
  extended by oracle.toplink.mappings.DatabaseMapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
AbstractCompositeDirectCollectionMapping, AbstractDirectMapping, AbstractTransformationMapping, AggregateMapping, ForeignReferenceMapping, XMLAnyAttributeMapping, XMLAnyCollectionMapping, XMLAnyObjectMapping, XMLChoiceCollectionMapping, XMLChoiceObjectMapping

public abstract class DatabaseMapping
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Purpose: Defines how an attribute of an object maps to and from the database

Responsibilities:

Since:
TOPLink/Java 1.0
See Also:
Serialized Form

Constructor Summary
DatabaseMapping()
          Default constructor.
 
Method Summary
 AttributeAccessor getAttributeAccessor()
          ADVANCED: Return the attributeAccessor.
 java.lang.Class getAttributeClassification()
          The classification type for the attribute this mapping represents
 java.lang.String getAttributeName()
          Return the name of the attribute set in the mapping.
 java.lang.String getGetMethodName()
          This method is invoked reflectively on the reference object to return the value of the attribute in the object.
 java.lang.Object getProperty(java.lang.Object property)
          ADVANCED: Allow user defined properties.
 ClassDescriptor getReferenceDescriptor()
          Return the referenceDescriptor.
 java.lang.String getSetMethodName()
          This method is invoked reflectively on the reference object to set the value of the attribute in the object.
 boolean isLazy()
          Return if this mapping is lazy.
 boolean isOptional()
          Return whether the value of this mapping is optional (that is, can be null).
 boolean isUsingMethodAccess()
          Return if method access is used.
 void readOnly()
          To make mapping read only.
 void readWrite()
          The mapping can be dynamically made either readOnly or readWriteOnly.
 void setAttributeAccessor(AttributeAccessor anAttributeAccessor)
          ADVANCED: Set the attributeAccessor.
 void setAttributeName(java.lang.String attributeName)
          Sets the name of the attribute in the mapping.
 void setGetMethodName(java.lang.String methodName)
          This method is invoked reflectively on the reference object to return the value of the attribute in the object.
 void setIsLazy(boolean isLazy)
          Set if this mapping is lazy.
 void setIsOptional(boolean isOptional)
          Used to specify whether the value of this mapping may be null.
 void setIsReadOnly(boolean aBoolean)
          Set this mapping to be read only.
 void setProperty(java.lang.Object property, java.lang.Object value)
          ADVANCED: Allow user defined properties.
 void setSetMethodName(java.lang.String methodName)
          Set the methodName used to set the value for the mapping's attribute into the object.
 void setWeight(java.lang.Integer newWeight)
          ADVANCED: Set the weight of the mapping, used to sort mappings DirectToField Mappings have a default weight of 1 while all other Mappings have a default weight of MAXINT.
 void simpleAddToCollectionChangeRecord(java.lang.Object referenceKey, java.lang.Object changeSetToAdd, oracle.toplink.internal.sessions.ObjectChangeSet changeSet, oracle.toplink.internal.sessions.AbstractSession session)
          ADVANCED: This method is used to add an object to a collection once the changeSet is applied.
 void simpleRemoveFromCollectionChangeRecord(java.lang.Object referenceKey, java.lang.Object changeSetToAdd, oracle.toplink.internal.sessions.ObjectChangeSet changeSet, oracle.toplink.internal.sessions.AbstractSession session)
          ADVANCED: This method is used to remove an object from a collection once the changeSet is applied.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DatabaseMapping

public DatabaseMapping()
Default constructor.

Method Detail

getAttributeAccessor

public AttributeAccessor getAttributeAccessor()
ADVANCED: Return the attributeAccessor. The attribute accessor is responsible for setting and retrieving the attribute value from the object for this mapping.


getAttributeClassification

public java.lang.Class getAttributeClassification()
The classification type for the attribute this mapping represents


getAttributeName

public java.lang.String getAttributeName()
Return the name of the attribute set in the mapping. The attribute name on the attributeAccessor will always override any attribute already set


getGetMethodName

public java.lang.String getGetMethodName()
This method is invoked reflectively on the reference object to return the value of the attribute in the object. This method returns the name of the getMethodName or null if not using method access.


getProperty

public java.lang.Object getProperty(java.lang.Object property)
ADVANCED: Allow user defined properties.


getReferenceDescriptor

public ClassDescriptor getReferenceDescriptor()
Return the referenceDescriptor. This is a descriptor which is associated with the reference class.


getSetMethodName

public java.lang.String getSetMethodName()
This method is invoked reflectively on the reference object to set the value of the attribute in the object. This method returns the name of the setMethodName or null if not using method access.


isUsingMethodAccess

public boolean isUsingMethodAccess()
Return if method access is used.


isOptional

public boolean isOptional()
Return whether the value of this mapping is optional (that is, can be null). This is a hint and is used when generating DDL.


isLazy

public boolean isLazy()
Return if this mapping is lazy. This can be used for any mapping type to exclude it from the descriptor's default fetch group. This means that queries will not include the field(s) required by this mapping by default. This can only be used if the descriptor has a FetchGroupManager and class implements the FetchGroupTracker interface (or is weaved). This is not the same as indirection on relationships (lazy relationships), as it defers the loading of the source object fields, not the relationship.


setIsLazy

public void setIsLazy(boolean isLazy)
Set if this mapping is lazy. This can be used for any mapping type to exclude it from the descriptor's default fetch group. This means that queries will not include the field(s) required by this mapping by default. This can only be used if the descriptor has a FetchGroupManager and class implements the FetchGroupTracker interface (or is weaved). This is not the same as indirection on relationships (lazy relationships), as it defers the loading of the source object fields, not the relationship.


readOnly

public void readOnly()
To make mapping read only. Read-only mappings can be used if two attributes map to the same field. Read-only mappings cannot be used for the primary key or other required fields.


readWrite

public void readWrite()
The mapping can be dynamically made either readOnly or readWriteOnly. This makes mapping go back to default mode.


setAttributeAccessor

public void setAttributeAccessor(AttributeAccessor anAttributeAccessor)
ADVANCED: Set the attributeAccessor. The attribute accessor is responsible for setting and retrieving the attribute value from the object for this mapping. This can be set to an implementor of AttributeAccessor if the attribute requires advanced conversion of the mapping value, or a real attribute does not exist.


setAttributeName

public void setAttributeName(java.lang.String attributeName)
Sets the name of the attribute in the mapping.


setGetMethodName

public void setGetMethodName(java.lang.String methodName)
This method is invoked reflectively on the reference object to return the value of the attribute in the object. This method sets the name of the getMethodName.


setIsOptional

public void setIsOptional(boolean isOptional)
Used to specify whether the value of this mapping may be null. This is used when generating DDL.


setIsReadOnly

public void setIsReadOnly(boolean aBoolean)
Set this mapping to be read only. Read-only mappings can be used if two attributes map to the same field. Read-only mappings cannot be used for the primary key or other required fields.


setProperty

public void setProperty(java.lang.Object property,
                        java.lang.Object value)
ADVANCED: Allow user defined properties.


setSetMethodName

public void setSetMethodName(java.lang.String methodName)
Set the methodName used to set the value for the mapping's attribute into the object.


setWeight

public void setWeight(java.lang.Integer newWeight)
ADVANCED: Set the weight of the mapping, used to sort mappings DirectToField Mappings have a default weight of 1 while all other Mappings have a default weight of MAXINT. Ordering of Mappings can be achieved by setting the weight of a particular mapping to a value within the above mentioned limits. By ordering mappings the user can control what order relationships are processed by TopLink.


simpleAddToCollectionChangeRecord

public void simpleAddToCollectionChangeRecord(java.lang.Object referenceKey,
                                              java.lang.Object changeSetToAdd,
                                              oracle.toplink.internal.sessions.ObjectChangeSet changeSet,
                                              oracle.toplink.internal.sessions.AbstractSession session)
                                       throws DescriptorException
ADVANCED: This method is used to add an object to a collection once the changeSet is applied. The referenceKey parameter should only be used for direct Maps.

Throws:
DescriptorException

simpleRemoveFromCollectionChangeRecord

public void simpleRemoveFromCollectionChangeRecord(java.lang.Object referenceKey,
                                                   java.lang.Object changeSetToAdd,
                                                   oracle.toplink.internal.sessions.ObjectChangeSet changeSet,
                                                   oracle.toplink.internal.sessions.AbstractSession session)
                                            throws DescriptorException
ADVANCED: This method is used to remove an object from a collection once the changeSet is applied. The referenceKey parameter should only be used for direct Maps.

Throws:
DescriptorException

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