EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference

org.eclipse.persistence.mappings.foundation
Class AbstractDirectMapping

java.lang.Object
  extended by org.eclipse.persistence.mappings.DatabaseMapping
      extended by org.eclipse.persistence.mappings.foundation.AbstractDirectMapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, MapComponentMapping, MapKeyMapping
Direct Known Subclasses:
DirectToFieldMapping, EISDirectMapping, XMLDirectMapping

public abstract class AbstractDirectMapping
extends DatabaseMapping
implements MapKeyMapping

Purpose: Maps an attribute to the corresponding database field type. The list of field types that are supported by EclipseLink's direct to field mapping is dependent on the relational database being used. A converter can be used to convert between the object and data type if they do not match.

See Also:
Converter, ObjectTypeConverter, TypeConversionConverter, SerializedObjectConverter, ClassInstanceConverter, Serialized Form
Author:
Sati
Since:
TopLink/Java 1.0

Field Summary
protected  java.lang.Class attributeClassification
          To specify the conversion type
protected  java.lang.String attributeClassificationName
           
protected  java.lang.Class attributeObjectClassification
          PERF: Also store object class of attribute in case of primitive.
protected  Converter converter
          Allows user defined conversion between the object attribute value and the database value.
protected  java.lang.String converterClassName
           
protected  org.eclipse.persistence.internal.helper.DatabaseField field
          DatabaseField which this mapping represents.
protected  java.lang.Boolean isMutable
          PERF: Indicates if this mapping's attribute is a simple atomic value and cannot be modified, only replaced.
protected  java.lang.Object nullValue
          Support specification of the value to use for null.
 
Fields inherited from class org.eclipse.persistence.mappings.DatabaseMapping
attributeAccessor, attributeName, descriptor, fields, isLazy, isOptional, isPrimaryKeyMapping, isReadOnly, isRemotelyInitialized, NO_FIELDS, NO_WEIGHT, properties, weight, WEIGHT_1
 
Constructor Summary
AbstractDirectMapping()
          Default constructor.
 
Method Summary
 void buildBackupClone(java.lang.Object clone, java.lang.Object backup, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
          INTERNAL: Clone the attribute from the clone and assign it to the backup.
 org.eclipse.persistence.internal.sessions.ChangeRecord buildChangeRecord(java.lang.Object clone, org.eclipse.persistence.internal.sessions.ObjectChangeSet owner, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Directly build a change record without comparison
 void buildClone(java.lang.Object original, java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
          INTERNAL: Clone the attribute from the original and assign it to the clone.
 void buildCloneFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, java.lang.Object clone, ObjectBuildingQuery sourceQuery, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
          INTERNAL: Extract value from the row and set the attribute to this value in the working copy clone.
 void buildCloneValue(java.lang.Object original, java.lang.Object clone, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Clone the attribute from the original and assign it to the clone.
 void buildCopy(java.lang.Object copy, java.lang.Object original, ObjectCopyingPolicy policy)
          INTERNAL: Copy of the attribute of the object.
 Expression buildExpression(java.lang.Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, java.util.Map processedObjects, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: In case Query By Example is used, this method builds and returns an expression that corresponds to a single attribute and it's value for a directToField mapping.
 void buildShallowOriginalFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, java.lang.Object original, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery query, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
          INTERNAL: Builds a shallow original object.
 void cascadePerformRemoveIfRequired(java.lang.Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, java.util.Map visitedObjects)
          INTERNAL: Cascade perform delete through mappings that require the cascade
 void cascadeRegisterNewIfRequired(java.lang.Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, java.util.Map visitedObjects)
          INTERNAL: Cascade registerNew for Create through mappings that require the cascade
 java.lang.Object clone()
          INTERNAL: The mapping clones itself to create deep copy.
protected  java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> collectFields()
          Returns the field this mapping represents.
 org.eclipse.persistence.internal.sessions.ChangeRecord compareForChange(java.lang.Object clone, java.lang.Object backUp, org.eclipse.persistence.internal.sessions.ObjectChangeSet owner, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Compare the clone and backup clone values and return a change record if the value changed.
 boolean compareObjects(java.lang.Object firstObject, java.lang.Object secondObject, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Compare the attributes belonging to this mapping for the objects.
protected  boolean compareObjectValues(java.lang.Object firstValue, java.lang.Object secondValue, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Compare the attribute values.
 void convertClassNamesToClasses(java.lang.ClassLoader classLoader)
          INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings This method is implemented by subclasses as necessary.
 void fixObjectReferences(java.lang.Object object, java.util.Map objectDescriptors, java.util.Map processedObjects, ObjectLevelReadQuery query, RemoteSession session)
          INTERNAL: An object has been serialized from the server to the client.
 java.lang.Class getAttributeClassification()
          PUBLIC: Some databases do not properly support all of the base data types.
 java.lang.String getAttributeClassificationName()
          INTERNAL: Return the class name of the attribute type.
 java.lang.Object getAttributeValue(java.lang.Object fieldValue, Session session)
          INTERNAL: Allows for subclasses to convert the attribute value.
 Converter getConverter()
          PUBLIC: Return the converter on the mapping.
 org.eclipse.persistence.internal.helper.DatabaseField getField()
          INTERNAL: Returns the field which this mapping represents.
 java.lang.Class getFieldClassification()
          ADVANCED: Return the class type of the field value.
 java.lang.Class getFieldClassification(org.eclipse.persistence.internal.helper.DatabaseField fieldToClassify)
          INTERNAL: Return the classification for the field contained in the mapping.
 java.lang.String getFieldName()
          PUBLIC: Name of the field this mapping represents.
 java.lang.Object getFieldValue(java.lang.Object attributeValue, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Convert the attribute value to a field value.
 java.lang.Object getNullValue()
          PUBLIC: Allow for the value used for null to be specified.
 java.lang.Integer getWeight()
          INTERNAL: Return the weight of the mapping, used to sort mappings to ensure that DirectToField Mappings get merged first
 boolean hasConverter()
          Indicates if the mapping has a converter set on it.
 void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: The mapping is initialized with the given session.
 org.eclipse.persistence.internal.sessions.ChangeRecord internalBuildChangeRecord(java.lang.Object newValue, org.eclipse.persistence.internal.sessions.ObjectChangeSet owner)
          INTERNAL: Build a change record
 boolean isAbstractDirectMapping()
          INTERNAL:
 boolean isChangeTrackingSupported(Project project)
          INTERNAL: Return if this mapping supports change tracking.
 boolean isCloningRequired()
          INTERNAL: Return if this mapping requires its attribute value to be cloned.
 boolean isDirectToFieldMapping()
          INTERNAL:
 boolean isMutable()
          PUBLIC: Return true if the attribute for this mapping is a simple atomic value that cannot be modified, only replaced.
 void iterate(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator)
          INTERNAL: Iterate on the appropriate attribute.
 void mergeChangesIntoObject(java.lang.Object target, org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, java.lang.Object source, org.eclipse.persistence.internal.sessions.MergeManager mergeManager)
          INTERNAL: Merge changes from the source to the target object.
 void mergeIntoObject(java.lang.Object target, boolean isTargetUnInitialized, java.lang.Object source, org.eclipse.persistence.internal.sessions.MergeManager mergeManager)
          INTERNAL: Merge changes from the source to the target object.
 void preInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Initialize the attribute classification.
 void remoteInitialization(DistributedSession session)
          INTERNAL: Once descriptors are serialized to the remote session.
 void setAttributeClassification(java.lang.Class attributeClassification)
          PUBLIC: Some databases do not properly support all of the base data types.
 void setAttributeClassificationName(java.lang.String attributeClassificationName)
          INTERNAL: Set the name of the class for MW usage.
 void setConverter(Converter converter)
          PUBLIC: Set the converter on the mapping.
 void setConverterClassName(java.lang.String converterClassName)
          PUBLIC: Set the converter class name on the mapping.
 void setField(org.eclipse.persistence.internal.helper.DatabaseField theField)
          ADVANCED: Set the field in the mapping.
 void setFieldClassification(java.lang.Class fieldType)
          ADVANCED: Set the class type of the field value.
 void setFieldType(int jdbcType)
          ADVANCED: Set the JDBC type of the field value.
 void setIsMutable(boolean isMutable)
          PUBLIC: Return true if the attribute for this mapping is a simple atomic value that cannot be modified, only replaced.
 void setNullValue(java.lang.Object nullValue)
          PUBLIC: Allow for the value used for null to be specified.
 java.lang.String toString()
          INTERNAL:
 void updateChangeRecord(java.lang.Object clone, java.lang.Object newValue, java.lang.Object oldValue, org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
          INTERNAL: Either create a new change record or update with the new value.
 void validateBeforeInitialization(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Allow for subclasses to perform validation.
 java.lang.Object valueFromObject(java.lang.Object object, org.eclipse.persistence.internal.helper.DatabaseField field, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Get the value from the object for this mapping.
 java.lang.Object valueFromResultSet(java.sql.ResultSet resultSet, ObjectLevelReadQuery query, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor accessor, java.sql.ResultSetMetaData metaData, int columnNumber, org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform)
          INTERNAL: Returns the value for the mapping directly from the result-set.
 java.lang.Object valueFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery query, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
          INTERNAL: Return the mapping's attribute value from the row.
 void writeFromObjectIntoRow(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Get a value from the object and set that in the respective field of the row.
 void writeFromObjectIntoRowForUpdate(WriteObjectQuery query, org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow)
          INTERNAL: Write the attribute value from the object to the row for update.
 void writeFromObjectIntoRowWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Get a value from the object and set that in the respective field of the row.
 void writeInsertFieldsIntoRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Write fields needed for insert into the template for with null values.
protected abstract  void writeValueIntoRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.helper.DatabaseField field, java.lang.Object value)
           
 
Methods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
addToCollectionChangeRecord, buildBackupCloneForPartObject, buildCloneForPartObject, buildObjectJoinExpression, buildObjectJoinExpression, calculateDeferredChanges, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadeMerge, cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired, cloneFields, createUnitOfWorkValueHolder, extractNestedExpressions, fixRealObjectReferences, getAttributeAccessor, getAttributeName, getAttributeValueFromObject, getContainerPolicy, getDescriptor, getFields, getGetMethodName, getObjectCorrespondingTo, getProperties, getProperty, getRealAttributeValueFromAttribute, getRealAttributeValueFromObject, getRealCollectionAttributeValueFromObject, getReferenceDescriptor, getRelationshipPartner, getSelectFields, getSelectTables, getSetMethodName, getValueFromRemoteValueHolder, hasConstraintDependency, hasDependency, hasInverseConstraintDependency, hasRootExpressionThatShouldUseOuterJoin, instantiateAttribute, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isCandidateForPrivateOwnedRemoval, isCascadedLockingSupported, isCollectionMapping, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToXMLTypeMapping, isEISMapping, isForeignReferenceMapping, isJoiningSupported, isLazy, isManyToManyMapping, isNestedTableMapping, isObjectReferenceMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isPrimaryKeyMapping, isPrivateOwned, isReadOnly, isReferenceMapping, isRelationalMapping, isRemotelyInitialized, isStructureMapping, isTransformationMapping, isUnidirectionalOneToManyMapping, isUsingMethodAccess, isVariableOneToOneMapping, isWriteOnly, isXMLMapping, iterateOnRealAttributeValue, performDataModificationEvent, postCalculateChanges, postCalculateChangesOnDeleted, postDelete, postInitialize, postInsert, postUpdate, preDelete, preInsert, prepareCascadeLockingPolicy, preUpdate, readFromResultSetIntoObject, readFromRowIntoObject, readOnly, readWrite, rehashFieldDependancies, remotelyInitialized, removeFromCollectionChangeRecord, replaceValueHoldersIn, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setChangeListener, setDescriptor, setFields, setGetMethodName, setIsLazy, setIsOptional, setIsPrimaryKeyMapping, setIsReadOnly, setProperties, setProperty, setRealAttributeValueInObject, setSetMethodName, setWeight, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, updateCollectionChangeRecord, validateAfterInitialization, valueFromResultSet, valueFromRow, verifyDelete, writeFromAttributeIntoRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForWhereClause, writeUpdateFieldsIntoRow
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

field

protected org.eclipse.persistence.internal.helper.DatabaseField field
DatabaseField which this mapping represents.


attributeClassification

protected transient java.lang.Class attributeClassification
To specify the conversion type


attributeClassificationName

protected transient java.lang.String attributeClassificationName

attributeObjectClassification

protected transient java.lang.Class attributeObjectClassification
PERF: Also store object class of attribute in case of primitive.


converter

protected Converter converter
Allows user defined conversion between the object attribute value and the database value.


converterClassName

protected java.lang.String converterClassName

nullValue

protected transient java.lang.Object nullValue
Support specification of the value to use for null.


isMutable

protected java.lang.Boolean isMutable
PERF: Indicates if this mapping's attribute is a simple atomic value and cannot be modified, only replaced. This is a tri-state to allow user to set to true or false, as default is false but some data-types such as Calendar or byte[] or converter types may be desired to be used as mutable.

Constructor Detail

AbstractDirectMapping

public AbstractDirectMapping()
Default constructor.

Method Detail

getConverter

public Converter getConverter()
PUBLIC: Return the converter on the mapping. A converter can be used to convert between the object's value and database value of the attribute.


setConverter

public void setConverter(Converter converter)
PUBLIC: Set the converter on the mapping. A converter can be used to convert between the object's value and database value of the attribute.


setConverterClassName

public void setConverterClassName(java.lang.String converterClassName)
PUBLIC: Set the converter class name on the mapping. It will be instantiated during the convertClassNamesToClasses. A converter can be used to convert between the object's value and database value of the attribute.


isMutable

public boolean isMutable()
PUBLIC: Return true if the attribute for this mapping is a simple atomic value that cannot be modified, only replaced. This is false by default unless a mutable converter is used such as the SerializedObjectConverter. This can be set to false in this case, or if a Calendar or byte[] is desired to be used as a mutable value it can be set to true.


setIsMutable

public void setIsMutable(boolean isMutable)
PUBLIC: Return true if the attribute for this mapping is a simple atomic value that cannot be modified, only replaced. This is false by default unless a mutable converter is used such as the SerializedObjectConverter. This can be set to false in this case, or if a Calendar or byte[] is desired to be used as a mutable value it can be set to true.


buildBackupClone

public void buildBackupClone(java.lang.Object clone,
                             java.lang.Object backup,
                             org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
INTERNAL: Clone the attribute from the clone and assign it to the backup.

Specified by:
buildBackupClone in class DatabaseMapping

buildClone

public void buildClone(java.lang.Object original,
                       java.lang.Object clone,
                       org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
INTERNAL: Clone the attribute from the original and assign it to the clone.

Specified by:
buildClone in class DatabaseMapping

buildCloneValue

public void buildCloneValue(java.lang.Object original,
                            java.lang.Object clone,
                            org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Clone the attribute from the original and assign it to the clone. If mutability is configured to be true, clone the attribute if it is an instance of byte[], java.util.Calendar or java.util.Date (or their subclasses).


buildCopy

public void buildCopy(java.lang.Object copy,
                      java.lang.Object original,
                      ObjectCopyingPolicy policy)
INTERNAL: Copy of the attribute of the object. This is NOT used for unit of work but for templatizing an object.

Overrides:
buildCopy in class DatabaseMapping

buildExpression

public Expression buildExpression(java.lang.Object queryObject,
                                  QueryByExamplePolicy policy,
                                  Expression expressionBuilder,
                                  java.util.Map processedObjects,
                                  org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: In case Query By Example is used, this method builds and returns an expression that corresponds to a single attribute and it's value for a directToField mapping.

Overrides:
buildExpression in class DatabaseMapping

cascadePerformRemoveIfRequired

public void cascadePerformRemoveIfRequired(java.lang.Object object,
                                           org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
                                           java.util.Map visitedObjects)
INTERNAL: Cascade perform delete through mappings that require the cascade

Specified by:
cascadePerformRemoveIfRequired in class DatabaseMapping

cascadeRegisterNewIfRequired

public void cascadeRegisterNewIfRequired(java.lang.Object object,
                                         org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
                                         java.util.Map visitedObjects)
INTERNAL: Cascade registerNew for Create through mappings that require the cascade

Specified by:
cascadeRegisterNewIfRequired in class DatabaseMapping

clone

public java.lang.Object clone()
INTERNAL: The mapping clones itself to create deep copy.

Overrides:
clone in class DatabaseMapping

collectFields

protected java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> collectFields()
Returns the field this mapping represents.

Overrides:
collectFields in class DatabaseMapping

compareForChange

public org.eclipse.persistence.internal.sessions.ChangeRecord compareForChange(java.lang.Object clone,
                                                                               java.lang.Object backUp,
                                                                               org.eclipse.persistence.internal.sessions.ObjectChangeSet owner,
                                                                               org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Compare the clone and backup clone values and return a change record if the value changed.

Specified by:
compareForChange in class DatabaseMapping
Returns:
prototype.changeset.ChangeRecord

buildChangeRecord

public org.eclipse.persistence.internal.sessions.ChangeRecord buildChangeRecord(java.lang.Object clone,
                                                                                org.eclipse.persistence.internal.sessions.ObjectChangeSet owner,
                                                                                org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Directly build a change record without comparison

Overrides:
buildChangeRecord in class DatabaseMapping

internalBuildChangeRecord

public org.eclipse.persistence.internal.sessions.ChangeRecord internalBuildChangeRecord(java.lang.Object newValue,
                                                                                        org.eclipse.persistence.internal.sessions.ObjectChangeSet owner)
INTERNAL: Build a change record


compareObjects

public boolean compareObjects(java.lang.Object firstObject,
                              java.lang.Object secondObject,
                              org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Compare the attributes belonging to this mapping for the objects.

Specified by:
compareObjects in class DatabaseMapping

compareObjectValues

protected boolean compareObjectValues(java.lang.Object firstValue,
                                      java.lang.Object secondValue,
                                      org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Compare the attribute values.


convertClassNamesToClasses

public void convertClassNamesToClasses(java.lang.ClassLoader classLoader)
INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings This method is implemented by subclasses as necessary.

Overrides:
convertClassNamesToClasses in class DatabaseMapping
Parameters:
classLoader -

fixObjectReferences

public void fixObjectReferences(java.lang.Object object,
                                java.util.Map objectDescriptors,
                                java.util.Map processedObjects,
                                ObjectLevelReadQuery query,
                                RemoteSession session)
INTERNAL: An object has been serialized from the server to the client. Replace the transient attributes of the remote value holders with client-side objects.

Specified by:
fixObjectReferences in class DatabaseMapping

getAttributeClassification

public java.lang.Class getAttributeClassification()
PUBLIC: Some databases do not properly support all of the base data types. For these databases, the base data type must be explicitly specified in the mapping to tell EclipseLink to force the instance variable value to that data type

Overrides:
getAttributeClassification in class DatabaseMapping

getAttributeClassificationName

public java.lang.String getAttributeClassificationName()
INTERNAL: Return the class name of the attribute type. This is only used by the MW.


getAttributeValue

public java.lang.Object getAttributeValue(java.lang.Object fieldValue,
                                          Session session)
INTERNAL: Allows for subclasses to convert the attribute value.


getField

public org.eclipse.persistence.internal.helper.DatabaseField getField()
INTERNAL: Returns the field which this mapping represents.

Overrides:
getField in class DatabaseMapping

isAbstractDirectMapping

public boolean isAbstractDirectMapping()
INTERNAL:

Overrides:
isAbstractDirectMapping in class DatabaseMapping

getFieldClassification

public java.lang.Class getFieldClassification(org.eclipse.persistence.internal.helper.DatabaseField fieldToClassify)
INTERNAL: Return the classification for the field contained in the mapping. This is used to convert the row value to a consistent Java value.

Overrides:
getFieldClassification in class DatabaseMapping

getFieldClassification

public java.lang.Class getFieldClassification()
ADVANCED: Return the class type of the field value. This can be used if field value differs from the object value, has specific typing requirements such as usage of java.sql.Blob or NChar.


setFieldClassification

public void setFieldClassification(java.lang.Class fieldType)
ADVANCED: Set the class type of the field value. This can be used if field value differs from the object value, has specific typing requirements such as usage of java.sql.Blob or NChar. This must be called after the field name has been set.


setFieldType

public void setFieldType(int jdbcType)
ADVANCED: Set the JDBC type of the field value. This can be used if field type does not correspond directly to a Java class type, such as MONEY. This is used for binding.


getFieldName

public java.lang.String getFieldName()
PUBLIC: Name of the field this mapping represents.


getFieldValue

public java.lang.Object getFieldValue(java.lang.Object attributeValue,
                                      org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Convert the attribute value to a field value. Process any converter if defined, and check for null values.


getNullValue

public java.lang.Object getNullValue()
PUBLIC: Allow for the value used for null to be specified. This can be used to convert database null values to application specific values, when null values are not allowed by the application (such as in primitives). Note: the default value for NULL is used on reads, writes, and query SQL generation


getWeight

public java.lang.Integer getWeight()
INTERNAL: Return the weight of the mapping, used to sort mappings to ensure that DirectToField Mappings get merged first

Overrides:
getWeight in class DatabaseMapping

remoteInitialization

public void remoteInitialization(DistributedSession session)
INTERNAL: Once descriptors are serialized to the remote session. All its mappings and reference descriptors are traversed. Usually mappings are initialized and serialized reference descriptors are replaced with local descriptors if they already exist on the remote session.

Overrides:
remoteInitialization in class DatabaseMapping

preInitialize

public void preInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
                   throws DescriptorException
INTERNAL: Initialize the attribute classification.

Overrides:
preInitialize in class DatabaseMapping
Throws:
DescriptorException

hasConverter

public boolean hasConverter()
Indicates if the mapping has a converter set on it.

Returns:
true if there is a converter set on the mapping, false otherwise.

initialize

public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
                throws DescriptorException
INTERNAL: The mapping is initialized with the given session. This mapping is fully initialized after this.

Overrides:
initialize in class DatabaseMapping
Throws:
DescriptorException

isDirectToFieldMapping

public boolean isDirectToFieldMapping()
INTERNAL:

Overrides:
isDirectToFieldMapping in class DatabaseMapping

iterate

public void iterate(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator)
INTERNAL: Iterate on the appropriate attribute.

Specified by:
iterate in class DatabaseMapping

mergeChangesIntoObject

public void mergeChangesIntoObject(java.lang.Object target,
                                   org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord,
                                   java.lang.Object source,
                                   org.eclipse.persistence.internal.sessions.MergeManager mergeManager)
INTERNAL: Merge changes from the source to the target object.

Specified by:
mergeChangesIntoObject in class DatabaseMapping

mergeIntoObject

public void mergeIntoObject(java.lang.Object target,
                            boolean isTargetUnInitialized,
                            java.lang.Object source,
                            org.eclipse.persistence.internal.sessions.MergeManager mergeManager)
INTERNAL: Merge changes from the source to the target object. This merge is only called when a changeSet for the target does not exist or the target is uninitialized

Specified by:
mergeIntoObject in class DatabaseMapping

setAttributeClassification

public void setAttributeClassification(java.lang.Class attributeClassification)
PUBLIC: Some databases do not properly support all of the base data types. For these databases, the base data type must be explicitly specified in the mapping to tell TopLink to force the instance variable value to that data type


setAttributeClassificationName

public void setAttributeClassificationName(java.lang.String attributeClassificationName)
INTERNAL: Set the name of the class for MW usage.


setField

public void setField(org.eclipse.persistence.internal.helper.DatabaseField theField)
ADVANCED: Set the field in the mapping. This can be used for advanced field types, such as XML nodes, or to set the field type.


setNullValue

public void setNullValue(java.lang.Object nullValue)
PUBLIC: Allow for the value used for null to be specified. This can be used to convert database null values to application specific values, when null values are not allowed by the application (such as in primitives). Note: the default value for NULL is used on reads, writes, and query SQL generation


toString

public java.lang.String toString()
INTERNAL:

Overrides:
toString in class DatabaseMapping

updateChangeRecord

public void updateChangeRecord(java.lang.Object clone,
                               java.lang.Object newValue,
                               java.lang.Object oldValue,
                               org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet,
                               org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
INTERNAL: Either create a new change record or update with the new value. This is used by attribute change tracking.

Overrides:
updateChangeRecord in class DatabaseMapping

isChangeTrackingSupported

public boolean isChangeTrackingSupported(Project project)
INTERNAL: Return if this mapping supports change tracking.

Overrides:
isChangeTrackingSupported in class DatabaseMapping

isCloningRequired

public boolean isCloningRequired()
INTERNAL: Return if this mapping requires its attribute value to be cloned.

Overrides:
isCloningRequired in class DatabaseMapping

validateBeforeInitialization

public void validateBeforeInitialization(org.eclipse.persistence.internal.sessions.AbstractSession session)
                                  throws DescriptorException
INTERNAL: Allow for subclasses to perform validation.

Overrides:
validateBeforeInitialization in class DatabaseMapping
Throws:
DescriptorException

valueFromObject

public java.lang.Object valueFromObject(java.lang.Object object,
                                        org.eclipse.persistence.internal.helper.DatabaseField field,
                                        org.eclipse.persistence.internal.sessions.AbstractSession session)
                                 throws DescriptorException
INTERNAL: Get the value from the object for this mapping.

Overrides:
valueFromObject in class DatabaseMapping
Throws:
DescriptorException

buildCloneFromRow

public void buildCloneFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                              org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                              java.lang.Object clone,
                              ObjectBuildingQuery sourceQuery,
                              org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork,
                              org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
INTERNAL: Extract value from the row and set the attribute to this value in the working copy clone. In order to bypass the shared cache when in transaction a UnitOfWork must be able to populate working copies directly from the row.

Specified by:
buildCloneFromRow in class DatabaseMapping

buildShallowOriginalFromRow

public void buildShallowOriginalFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                        java.lang.Object original,
                                        org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                        ObjectBuildingQuery query,
                                        org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
INTERNAL: Builds a shallow original object. Only direct attributes and primary keys are populated. In this way the minimum original required for instantiating a working copy clone can be built without placing it in the shared cache (no concern over cycles).

Overrides:
buildShallowOriginalFromRow in class DatabaseMapping

valueFromRow

public java.lang.Object valueFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                     org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                     ObjectBuildingQuery query,
                                     org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
INTERNAL: Return the mapping's attribute value from the row. The execution session is passed for the case of building a UnitOfWork clone directly from a row, the session set in the query will not know which platform to use for converting the value. Allows the correct session to be passed in.

Overrides:
valueFromRow in class DatabaseMapping

valueFromResultSet

public java.lang.Object valueFromResultSet(java.sql.ResultSet resultSet,
                                           ObjectLevelReadQuery query,
                                           org.eclipse.persistence.internal.sessions.AbstractSession session,
                                           org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor accessor,
                                           java.sql.ResultSetMetaData metaData,
                                           int columnNumber,
                                           org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform)
                                    throws DatabaseException
INTERNAL: Returns the value for the mapping directly from the result-set. PERF: Used for optimized object building.

Throws:
DatabaseException

writeFromObjectIntoRow

public void writeFromObjectIntoRow(java.lang.Object object,
                                   org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                   org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Get a value from the object and set that in the respective field of the row.

Overrides:
writeFromObjectIntoRow in class DatabaseMapping

writeValueIntoRow

protected abstract void writeValueIntoRow(org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                          org.eclipse.persistence.internal.helper.DatabaseField field,
                                          java.lang.Object value)

writeFromObjectIntoRowWithChangeRecord

public void writeFromObjectIntoRowWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord,
                                                   org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                                   org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Get a value from the object and set that in the respective field of the row. Validation preventing primary key updates is implemented here.

Overrides:
writeFromObjectIntoRowWithChangeRecord in class DatabaseMapping

writeFromObjectIntoRowForUpdate

public void writeFromObjectIntoRowForUpdate(WriteObjectQuery query,
                                            org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow)
INTERNAL: Write the attribute value from the object to the row for update.

Overrides:
writeFromObjectIntoRowForUpdate in class DatabaseMapping

writeInsertFieldsIntoRow

public void writeInsertFieldsIntoRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                     org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Write fields needed for insert into the template for with null values.

Overrides:
writeInsertFieldsIntoRow in class DatabaseMapping

EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference