Class AbstractTransformationMapping
- java.lang.Object
-
- org.eclipse.persistence.core.mappings.CoreMapping<AttributeAccessor,org.eclipse.persistence.internal.sessions.AbstractSession,org.eclipse.persistence.internal.queries.ContainerPolicy,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField>
-
- org.eclipse.persistence.mappings.DatabaseMapping
-
- org.eclipse.persistence.mappings.foundation.AbstractTransformationMapping
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
EISTransformationMapping
,TransformationMapping
,XMLTransformationMapping
public abstract class AbstractTransformationMapping extends DatabaseMapping
Purpose: A transformation mapping is used for a specialized translation between how a value is represented in Java and its representation on the databae. Transformation mappings should only be used when other mappings are inadequate.
- See Also:
- Serialized Form
- Author:
- Sati
- Since:
- TOPLink/Java 1.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.persistence.mappings.DatabaseMapping
DatabaseMapping.WriteType
-
-
Field Summary
Fields Modifier and Type Field Description protected AttributeTransformer
attributeTransformer
attributeTransformerClassName is converter to an instance of AttributeTransformerprotected java.lang.String
attributeTransformerClassName
Name of the class which implements AttributeTransformer to be used to retrieve the attribute valueprotected java.util.List<java.lang.Object[]>
fieldToTransformers
The TransformerClassNames are converted into instances of FieldTransformerprotected java.util.List<org.eclipse.persistence.internal.descriptors.FieldTransformation>
fieldTransformations
Stores field name and the class name of a FieldTransformer in a vector to preserve orderprotected org.eclipse.persistence.internal.indirection.IndirectionPolicy
indirectionPolicy
Implements indirection behaviourprotected boolean
isMutable
PERF: Indicates if this mapping's attribute is a simple value which cannot be modified only replaced.-
Fields inherited from class org.eclipse.persistence.mappings.DatabaseMapping
attributeAccessor, attributeName, derivedIdMapping, derivesId, descriptor, fields, isCacheable, isInSopObject, isJPAId, isLazy, isMapKeyMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isRemotelyInitialized, mapsIdValue, NO_FIELDS, NO_WEIGHT, properties, unconvertedProperties, weight, WEIGHT_AGGREGATE, WEIGHT_DIRECT, WEIGHT_TO_ONE, WEIGHT_TRANSFORM
-
-
Constructor Summary
Constructors Constructor Description AbstractTransformationMapping()
PUBLIC: Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFieldTransformation(java.lang.String fieldName, java.lang.String methodName)
PUBLIC: Add the name of field and the name of the method that returns the value to be placed in said field when the object is written to the database.void
addFieldTransformation(org.eclipse.persistence.internal.helper.DatabaseField field, java.lang.String methodName)
PUBLIC: Add the field and the name of the method that returns the value to be placed in said field when the object is written to the database.void
addFieldTransformer(java.lang.String fieldName, FieldTransformer transformer)
PUBLIC: Add the name of field and the transformer that returns the value to be placed in the field when the object is written to the database.void
addFieldTransformer(org.eclipse.persistence.internal.helper.DatabaseField field, FieldTransformer transformer)
PUBLIC: Add the field and the transformer that returns the value to be placed in the field when the object is written to the database.void
addFieldTransformerClassName(java.lang.String fieldName, java.lang.String className)
INTERNAL: Add the name of a field and the name of a class which implements the FieldTransformer interface.void
addFieldTransformerClassName(org.eclipse.persistence.internal.helper.DatabaseField field, java.lang.String className)
INTERNAL: Add the name of a field and the name of a class which implements the FieldTransformer interface.protected boolean
areObjectsToBeProcessedInstantiated(java.lang.Object object)
INTERNAL: The referenced object is checked if it is instantiated or notvoid
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.java.lang.Object
buildBackupCloneForPartObject(java.lang.Object attributeValue, java.lang.Object clone, java.lang.Object backup, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
INTERNAL: Used during building the backup shallow copy to copy the vector without re-registering the target objects.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 comparisonvoid
buildClone(java.lang.Object original, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, java.lang.Object clone, java.lang.Integer refreshCascade, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession)
INTERNAL: Clone the attribute from the original and assign it to the clone.java.lang.Object
buildCloneForPartObject(java.lang.Object attributeValue, java.lang.Object original, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, java.lang.Object clone, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession, java.lang.Integer refreshCascade, boolean isExisting, boolean isFromSharedCache)
INTERNAL: Require for cloning, the part must be cloned.void
buildCloneFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord record, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, java.lang.Object clone, org.eclipse.persistence.internal.identitymaps.CacheKey sharedCacheKey, 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
buildCopy(java.lang.Object copy, java.lang.Object original, CopyGroup group)
INTERNAL: Copy of the attribute of the object.protected org.eclipse.persistence.internal.sessions.AbstractRecord
buildPhantomRowFrom(java.lang.Object domainObject, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL Build a phantom row that contains only the fields for the mapping, populated with the values generated by invoking the field methods on the specified object.void
buildShallowOriginalFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord record, 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 cascadevoid
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 cascadejava.lang.Object
clone()
INTERNAL: The mapping clones itself to create deep copy.protected java.util.Vector
collectFields()
INTERNAL: Return all the fields with this mapping.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 attributes belonging to this mapping for the objects.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.void
convertClassNamesToClasses(java.lang.ClassLoader classLoader)
INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settingsorg.eclipse.persistence.internal.indirection.DatabaseValueHolder
createCloneValueHolder(ValueHolderInterface attributeValue, java.lang.Object original, java.lang.Object clone, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession, boolean buildDirectlyFromRow)
INTERNAL: Builder the unit of work value holder.void
dontUseIndirection()
PUBLIC: Indirection means that a ValueHolder will be put in-between the attribute and the real object.void
fixObjectReferences(java.lang.Object object, java.util.Map objectDescriptors, java.util.Map processedObjects, ObjectLevelReadQuery query, DistributedSession session)
INTERNAL: An object has been serialized from the server to the client.java.lang.String
getAttributeMethodName()
PUBLIC: Return the attribute transformation method name.AttributeTransformer
getAttributeTransformer()
INTERNAL: The attributeTransformer stores an instance of the class which implements AttributeTransformer.java.lang.Class
getAttributeTransformerClass()
INTERNAL: Return the attribute transformer's class.java.lang.String
getAttributeTransformerClassName()
INTERNAL: Return the attribute transformer class namejava.lang.Object
getAttributeValueFromObject(java.lang.Object object)
INTERNAL: Check for write-only, one-way transformation.java.util.Vector
getFieldNameToMethodNameAssociations()
INTERNAL: Needed for backwards compatibilityjava.util.Hashtable
getFieldNameToMethodNames()
INTERNAL: Required for reverse compatibility and test cases:java.util.List<java.lang.Object[]>
getFieldToTransformers()
INTERNAL:java.util.List<org.eclipse.persistence.internal.descriptors.FieldTransformation>
getFieldTransformations()
INTERNAL: Returns a Vector which stores fieldnames and the respective method/transformer names.org.eclipse.persistence.internal.indirection.IndirectionPolicy
getIndirectionPolicy()
INTERNAL: Return the mapping's indirection policy.java.lang.Object
getRealAttributeValueFromAttribute(java.lang.Object attributeValue, java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Returns the real attribute value from the reference object's attribute value.java.lang.Object
getValueFromRemoteValueHolder(org.eclipse.persistence.internal.sessions.remote.RemoteValueHolder remoteValueHolder)
INTERNAL: Extract and return the appropriate value from the specified remote value holder.void
initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: The mapping is initialized with the given session.protected void
initializeAttributeTransformer(org.eclipse.persistence.internal.sessions.AbstractSession databaseSession)
INTERNAL: Convert the attribute transformer class name into an AttributeTransformer If the old-style method name in set, then use a MethodBasedAttributeTRansformerprotected void
initializeFieldToTransformers(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Convert the field names and their corresponding method names to DatabaseFields and Methods.void
instantiateAttribute(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Trigger the instantiation of the attribute if lazy.org.eclipse.persistence.internal.sessions.ChangeRecord
internalBuildChangeRecord(java.lang.Object clone, java.lang.Object oldValue, org.eclipse.persistence.internal.sessions.ObjectChangeSet owner, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Build a change record.java.lang.Object
invokeAttributeTransformer(org.eclipse.persistence.internal.sessions.AbstractRecord record, java.lang.Object domainObject, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Invoke the buildAttributeValue method on the AttributeTransformerprotected java.lang.Object
invokeFieldTransformer(org.eclipse.persistence.internal.helper.DatabaseField field, java.lang.Object domainObject, org.eclipse.persistence.internal.sessions.AbstractSession session)
protected java.lang.Object
invokeFieldTransformer(org.eclipse.persistence.internal.helper.DatabaseField field, FieldTransformer transformer, java.lang.Object domainObject, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Invoke the buildFieldValue on the appropriate FieldTransformerboolean
isAttributeValueFromObjectInstantiated(java.lang.Object object)
INTERNAL: Return whether the specified object is instantiated.boolean
isChangeTrackingSupported(Project project)
INTERNAL: Return if this mapping supports change tracking.boolean
isMutable()
PUBLIC: Return true if the attribute for this mapping is not a simple atomic value that cannot be modified, only replaced.boolean
isReadOnly()
INTERNAL: Return true if read-only is explicitly set to true; otherwise return whether the transformation has no fields (no fields = read-only)boolean
isTransformationMapping()
INTERNAL:boolean
isWriteOnly()
INTERNAL: Return if the transformation has no attribute, is write only.void
iterate(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator)
INTERNAL: Perform the iteration opperation on the iterators current objects attributes.void
iterateOnRealAttributeValue(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator, java.lang.Object realAttributeValue)
INTERNAL: Iterate on the attribute value.void
mergeChangesIntoObject(java.lang.Object target, org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, java.lang.Object source, org.eclipse.persistence.internal.sessions.MergeManager mergeManager, org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
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, org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
INTERNAL: Merge changes from the source to the target object.void
preInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Allow for initialization of properties and validation.java.lang.Object
readFromReturnRowIntoObject(org.eclipse.persistence.internal.sessions.AbstractRecord row, java.lang.Object object, ReadObjectQuery query, java.util.Collection handledMappings, org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet)
INTERNAL: Extracts value from return row and set the attribute to the value in the object.java.lang.Object
readFromRowIntoObject(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, java.lang.Object object, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, ObjectBuildingQuery query, org.eclipse.persistence.internal.sessions.AbstractSession executionSession, boolean isTargetProtected)
INTERNAL: Extract value from the row and set the attribute to the value in the object.void
remoteInitialization(DistributedSession session)
INTERNAL: Once descriptors are serialized to the remote session.void
setAttributeTransformation(java.lang.String methodName)
PUBLIC: To set the attribute method name.void
setAttributeTransformer(AttributeTransformer transformer)
PUBLIC: Set the AttributeTransformer, this transformer will be used to extract the value for the object's attribute from the database row.void
setAttributeTransformerClass(java.lang.Class attributeTransformerClass)
INTERNAL: Set the attribute transformer's class.void
setAttributeTransformerClassName(java.lang.String className)
INTERNAL: Set the Attribute Transformer Class Namevoid
setAttributeValueInObject(java.lang.Object object, java.lang.Object value)
INTERNAL: Check for write-only, one-way transformations.void
setFieldNameToMethodNameAssociations(java.util.Vector associations)
INTERNAL: needed for backwards compatibilityprotected void
setFieldToTransformers(java.util.List<java.lang.Object[]> fieldToTransformers)
void
setFieldTransformations(java.util.List<org.eclipse.persistence.internal.descriptors.FieldTransformation> fieldTransformations)
INTERNAL: Set the field to method name associations.void
setIndirectionPolicy(org.eclipse.persistence.internal.indirection.IndirectionPolicy indirectionPolicy)
ADVANCED: Set the indirection policy.void
setIsMutable(boolean mutable)
PUBLIC: Set if the value of the attribute is atomic or a complex mutable object and can be modified without replacing the entire object.void
setRealAttributeValueInObject(java.lang.Object object, java.lang.Object value)
INTERNAL: Set the value of the attribute mapped by this mapping, placing it inside a value holder if necessary.void
setUsesIndirection(boolean usesIndirection)
INTERNAL: Will be used by Gromit.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 the change record with the new value.void
useBasicIndirection()
PUBLIC: Indirection means that a ValueHolder will be put in-between the attribute and the real object.void
useContainerIndirection(java.lang.Class containerClass)
PUBLIC: Indirection means that a IndirectContainer (wrapping a ValueHolder) will be put in-between the attribute and the real object.void
useIndirection()
PUBLIC: Indirection means that a ValueHolder will be put in-between the attribute and the real object.boolean
usesIndirection()
PUBLIC: Indirection means that a ValueHolder will be put in-between the attribute and the real object.void
validateBeforeInitialization(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Validate mapping declarationjava.lang.Object
valueFromObject(java.lang.Object object, org.eclipse.persistence.internal.helper.DatabaseField field, 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
writeFromObjectIntoRow(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType)
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 record)
INTERNAL: Get a value from the object and set that in the respective field of the row.void
writeFromObjectIntoRowWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType)
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 record, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Write fields needed for insert into the template for with null values.-
Methods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
addUnconvertedProperty, buildContainerClone, buildExpression, buildObjectJoinExpression, buildObjectJoinExpression, calculateDeferredChanges, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired, cloneFields, collectQueryParameters, convertConverterClassNamesToClasses, derivesId, earlyPreDelete, extractNestedExpressions, extractNestedNonAggregateExpressions, fixRealObjectReferences, getAttributeAccessor, getAttributeClassification, getAttributeName, getContainerPolicy, getDerivedIdMapping, getDescriptor, getField, getFieldClassification, getFields, getGetMethodName, getMapsIdValue, getObjectCorrespondingTo, getOrderByNormalizedExpressions, getProperties, getProperty, getRealAttributeValueFromObject, getRealCollectionAttributeValueFromObject, getReferenceDescriptor, getRelationshipPartner, getSelectFields, getSelectTables, getSetMethodName, getUnconvertedProperties, getWeight, hasConstraintDependency, hasDependency, hasInverseConstraintDependency, hasMapsIdValue, hasNestedIdentityReference, hasRootExpressionThatShouldUseOuterJoin, hasUnconvertedProperties, isAbstractColumnMapping, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isCacheable, isCandidateForPrivateOwnedRemoval, isCascadedLockingSupported, isCloningRequired, isCollectionMapping, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isElementCollectionMapping, isForeignReferenceMapping, isInAndOutSopObject, isInOnlySopObject, isInSopObject, isJoiningSupported, isJPAId, isLazy, isLockableMapping, isManyToManyMapping, isManyToOneMapping, isMapKeyMapping, isMultitenantPrimaryKeyMapping, isNestedTableMapping, isObjectReferenceMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isOutOnlySopObject, isOutSopObject, isOwned, isPrimaryKeyMapping, isPrivateOwned, isReferenceMapping, isRelationalMapping, isRemotelyInitialized, isStructureMapping, isUnidirectionalOneToManyMapping, isUsingMethodAccess, isVariableOneToOneMapping, isXMLMapping, load, loadAll, performDataModificationEvent, postCalculateChanges, postCalculateChangesOnDeleted, postDelete, postInitialize, postInitializeSourceAndTargetExpressions, postInsert, postUpdate, preDelete, preInsert, prepareCascadeLockingPolicy, preUpdate, readFromResultSetIntoObject, readOnly, readWrite, recordPrivateOwnedRemovals, rehashFieldDependancies, remotelyInitialized, replaceValueHoldersIn, setAttributeAccessor, setAttributeName, setChangeListener, setDerivedIdMapping, setDerivesId, setDescriptor, setFields, setGetMethodName, setIsCacheable, setIsInAndOutSopObject, setIsInSopObject, setIsJPAId, setIsLazy, setIsMapKeyMapping, setIsOptional, setIsOutSopObject, setIsPrimaryKeyMapping, setIsReadOnly, setMapsIdValue, setProperties, setProperty, setSetMethodName, setWeight, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, toString, updateCollectionChangeRecord, validateAfterInitialization, valueFromResultSet, valueFromRow, valueFromRow, verifyDelete, writeFromAttributeIntoRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdateAfterShallowInsert, writeFromObjectIntoRowForUpdateBeforeShallowDelete, writeFromObjectIntoRowForWhereClause, writeUpdateFieldsIntoRow
-
-
-
-
Field Detail
-
attributeTransformerClassName
protected java.lang.String attributeTransformerClassName
Name of the class which implements AttributeTransformer to be used to retrieve the attribute value
-
attributeTransformer
protected AttributeTransformer attributeTransformer
attributeTransformerClassName is converter to an instance of AttributeTransformer
-
fieldTransformations
protected java.util.List<org.eclipse.persistence.internal.descriptors.FieldTransformation> fieldTransformations
Stores field name and the class name of a FieldTransformer in a vector to preserve order
-
fieldToTransformers
protected java.util.List<java.lang.Object[]> fieldToTransformers
The TransformerClassNames are converted into instances of FieldTransformer
-
isMutable
protected boolean isMutable
PERF: Indicates if this mapping's attribute is a simple value which cannot be modified only replaced.
-
indirectionPolicy
protected org.eclipse.persistence.internal.indirection.IndirectionPolicy indirectionPolicy
Implements indirection behaviour
-
-
Method Detail
-
addFieldTransformation
public void addFieldTransformation(org.eclipse.persistence.internal.helper.DatabaseField field, java.lang.String methodName)
PUBLIC: Add the field and the name of the method that returns the value to be placed in said field when the object is written to the database. The method may take zero arguments, or it may take a single argument of typeorg.eclipse.persistence.sessions.Session
.
-
addFieldTransformation
public void addFieldTransformation(java.lang.String fieldName, java.lang.String methodName)
PUBLIC: Add the name of field and the name of the method that returns the value to be placed in said field when the object is written to the database. The method may take zero arguments, or it may take a single argument of typeorg.eclipse.persistence.sessions.Session
.
-
addFieldTransformerClassName
public void addFieldTransformerClassName(java.lang.String fieldName, java.lang.String className)
INTERNAL: Add the name of a field and the name of a class which implements the FieldTransformer interface. When the object is written, the transform method will be called on the FieldTransformer to acquire the value to put in the field.
-
addFieldTransformerClassName
public void addFieldTransformerClassName(org.eclipse.persistence.internal.helper.DatabaseField field, java.lang.String className)
INTERNAL: Add the name of a field and the name of a class which implements the FieldTransformer interface. When the object is written, the transform method will be called on the FieldTransformer to acquire the value to put in the field.
-
addFieldTransformer
public void addFieldTransformer(java.lang.String fieldName, FieldTransformer transformer)
PUBLIC: Add the name of field and the transformer that returns the value to be placed in the field when the object is written to the database.
-
addFieldTransformer
public void addFieldTransformer(org.eclipse.persistence.internal.helper.DatabaseField field, FieldTransformer transformer)
PUBLIC: Add the field and the transformer that returns the value to be placed in the field when the object is written to the database.
-
areObjectsToBeProcessedInstantiated
protected boolean areObjectsToBeProcessedInstantiated(java.lang.Object object)
INTERNAL: The referenced object is checked if it is instantiated or not
-
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 classDatabaseMapping
-
buildPhantomRowFrom
protected org.eclipse.persistence.internal.sessions.AbstractRecord buildPhantomRowFrom(java.lang.Object domainObject, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL Build a phantom row that contains only the fields for the mapping, populated with the values generated by invoking the field methods on the specified object.
-
buildShallowOriginalFromRow
public void buildShallowOriginalFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord record, 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 classDatabaseMapping
- Parameters:
original
- later the input to buildCloneFromRow
-
buildBackupCloneForPartObject
public java.lang.Object buildBackupCloneForPartObject(java.lang.Object attributeValue, java.lang.Object clone, java.lang.Object backup, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
INTERNAL: Used during building the backup shallow copy to copy the vector without re-registering the target objects. For 1-1 or ref the reference is from the clone so it is already registered.- Overrides:
buildBackupCloneForPartObject
in classDatabaseMapping
-
buildClone
public void buildClone(java.lang.Object original, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, java.lang.Object clone, java.lang.Integer refreshCascade, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession)
INTERNAL: Clone the attribute from the original and assign it to the clone.- Specified by:
buildClone
in classDatabaseMapping
-
buildCloneFromRow
public void buildCloneFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord record, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, java.lang.Object clone, org.eclipse.persistence.internal.identitymaps.CacheKey sharedCacheKey, 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 classDatabaseMapping
-
buildCloneForPartObject
public java.lang.Object buildCloneForPartObject(java.lang.Object attributeValue, java.lang.Object original, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, java.lang.Object clone, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession, java.lang.Integer refreshCascade, boolean isExisting, boolean isFromSharedCache)
INTERNAL: Require for cloning, the part must be cloned. Ignore the attribute value, go right to the object itself.- Overrides:
buildCloneForPartObject
in classDatabaseMapping
-
buildCopy
public void buildCopy(java.lang.Object copy, java.lang.Object original, CopyGroup group)
INTERNAL: Copy of the attribute of the object. This is NOT used for unit of work but for templatizing an object.- Overrides:
buildCopy
in classDatabaseMapping
-
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 classDatabaseMapping
-
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 classDatabaseMapping
-
clone
public java.lang.Object clone()
INTERNAL: The mapping clones itself to create deep copy.- Overrides:
clone
in classDatabaseMapping
-
collectFields
protected java.util.Vector collectFields()
INTERNAL: Return all the fields with this mapping.- Overrides:
collectFields
in classDatabaseMapping
-
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 attributes belonging to this mapping for the objects.- Specified by:
compareForChange
in classDatabaseMapping
- 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 classDatabaseMapping
-
internalBuildChangeRecord
public org.eclipse.persistence.internal.sessions.ChangeRecord internalBuildChangeRecord(java.lang.Object clone, java.lang.Object oldValue, org.eclipse.persistence.internal.sessions.ObjectChangeSet owner, org.eclipse.persistence.internal.sessions.AbstractSession session)
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 classDatabaseMapping
-
convertClassNamesToClasses
public void convertClassNamesToClasses(java.lang.ClassLoader classLoader)
INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings- Overrides:
convertClassNamesToClasses
in classDatabaseMapping
- Parameters:
classLoader
-
-
createCloneValueHolder
public org.eclipse.persistence.internal.indirection.DatabaseValueHolder createCloneValueHolder(ValueHolderInterface attributeValue, java.lang.Object original, java.lang.Object clone, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession, boolean buildDirectlyFromRow)
INTERNAL: Builder the unit of work value holder. Ignore the original object.- Overrides:
createCloneValueHolder
in classDatabaseMapping
- Parameters:
buildDirectlyFromRow
- indicates that we are building the clone directly from a row as opposed to building the original from the row, putting it in the shared cache, and then cloning the original.
-
dontUseIndirection
public void dontUseIndirection()
PUBLIC: Indirection means that a ValueHolder will be put in-between the attribute and the real object. This defaults to false and only required for transformations that perform database access.
-
fixObjectReferences
public void fixObjectReferences(java.lang.Object object, java.util.Map objectDescriptors, java.util.Map processedObjects, ObjectLevelReadQuery query, DistributedSession 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 classDatabaseMapping
-
getAttributeTransformer
public AttributeTransformer getAttributeTransformer()
INTERNAL: The attributeTransformer stores an instance of the class which implements AttributeTransformer.
-
getAttributeMethodName
public java.lang.String getAttributeMethodName()
PUBLIC: Return the attribute transformation method name.
-
getAttributeTransformerClass
public java.lang.Class getAttributeTransformerClass()
INTERNAL: Return the attribute transformer's class. This is used to map to XML.
-
setAttributeTransformerClass
public void setAttributeTransformerClass(java.lang.Class attributeTransformerClass)
INTERNAL: Set the attribute transformer's class. This is used to map from XML.
-
getAttributeTransformerClassName
public java.lang.String getAttributeTransformerClassName()
INTERNAL: Return the attribute transformer class name
-
getAttributeValueFromObject
public java.lang.Object getAttributeValueFromObject(java.lang.Object object) throws DescriptorException
INTERNAL: Check for write-only, one-way transformation.- Overrides:
getAttributeValueFromObject
in classDatabaseMapping
- Throws:
DescriptorException
-
getFieldTransformations
public java.util.List<org.eclipse.persistence.internal.descriptors.FieldTransformation> getFieldTransformations()
INTERNAL: Returns a Vector which stores fieldnames and the respective method/transformer names.
-
getFieldToTransformers
public java.util.List<java.lang.Object[]> getFieldToTransformers()
INTERNAL:- Returns:
- a vector which stores fields and their respective transformers.
-
getIndirectionPolicy
public org.eclipse.persistence.internal.indirection.IndirectionPolicy getIndirectionPolicy()
INTERNAL: Return the mapping's indirection policy.
-
getRealAttributeValueFromAttribute
public java.lang.Object getRealAttributeValueFromAttribute(java.lang.Object attributeValue, java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Returns the real attribute value from the reference object's attribute value. If the attribute is using indirection the value of the value-holder is returned. If the value holder is not instantiated then it is instantiated.- Overrides:
getRealAttributeValueFromAttribute
in classDatabaseMapping
-
instantiateAttribute
public void instantiateAttribute(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Trigger the instantiation of the attribute if lazy.- Overrides:
instantiateAttribute
in classDatabaseMapping
-
getValueFromRemoteValueHolder
public java.lang.Object getValueFromRemoteValueHolder(org.eclipse.persistence.internal.sessions.remote.RemoteValueHolder remoteValueHolder)
INTERNAL: Extract and return the appropriate value from the specified remote value holder.- Overrides:
getValueFromRemoteValueHolder
in classDatabaseMapping
-
initialize
public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
INTERNAL: The mapping is initialized with the given session.- Overrides:
initialize
in classDatabaseMapping
- Throws:
DescriptorException
-
initializeAttributeTransformer
protected void initializeAttributeTransformer(org.eclipse.persistence.internal.sessions.AbstractSession databaseSession) throws DescriptorException
INTERNAL: Convert the attribute transformer class name into an AttributeTransformer If the old-style method name in set, then use a MethodBasedAttributeTRansformer- Throws:
DescriptorException
-
getFieldNameToMethodNames
public java.util.Hashtable getFieldNameToMethodNames()
INTERNAL: Required for reverse compatibility and test cases:- Returns:
- a hash table containing the fieldName and their respective method names
-
initializeFieldToTransformers
protected void initializeFieldToTransformers(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
INTERNAL: Convert the field names and their corresponding method names to DatabaseFields and Methods.- Throws:
DescriptorException
-
invokeAttributeTransformer
public java.lang.Object invokeAttributeTransformer(org.eclipse.persistence.internal.sessions.AbstractRecord record, java.lang.Object domainObject, org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
INTERNAL: Invoke the buildAttributeValue method on the AttributeTransformer- Throws:
DescriptorException
-
invokeFieldTransformer
protected java.lang.Object invokeFieldTransformer(org.eclipse.persistence.internal.helper.DatabaseField field, FieldTransformer transformer, java.lang.Object domainObject, org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
INTERNAL: Invoke the buildFieldValue on the appropriate FieldTransformer- Throws:
DescriptorException
-
invokeFieldTransformer
protected java.lang.Object invokeFieldTransformer(org.eclipse.persistence.internal.helper.DatabaseField field, java.lang.Object domainObject, org.eclipse.persistence.internal.sessions.AbstractSession session)
-
isMutable
public boolean isMutable()
PUBLIC: Return true if the attribute for this mapping is not a simple atomic value that cannot be modified, only replaced. This is true by default for non-primitives, but can be set to false to avoid cloning and change comparison in the unit of work.
-
isReadOnly
public boolean isReadOnly()
INTERNAL: Return true if read-only is explicitly set to true; otherwise return whether the transformation has no fields (no fields = read-only)- Overrides:
isReadOnly
in classDatabaseMapping
-
isTransformationMapping
public boolean isTransformationMapping()
INTERNAL:- Overrides:
isTransformationMapping
in classDatabaseMapping
-
isWriteOnly
public boolean isWriteOnly()
INTERNAL: Return if the transformation has no attribute, is write only.- Overrides:
isWriteOnly
in classDatabaseMapping
-
iterate
public void iterate(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator)
INTERNAL: Perform the iteration opperation on the iterators current objects attributes. Only require if primitives are desired.- Specified by:
iterate
in classDatabaseMapping
-
iterateOnRealAttributeValue
public void iterateOnRealAttributeValue(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator, java.lang.Object realAttributeValue)
INTERNAL: Iterate on the attribute value. The value holder has already been processed.- Overrides:
iterateOnRealAttributeValue
in classDatabaseMapping
-
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, org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
INTERNAL: Merge changes from the source to the target object. Which is the original from the parent UnitOfWork- Specified by:
mergeChangesIntoObject
in classDatabaseMapping
-
mergeIntoObject
public void mergeIntoObject(java.lang.Object target, boolean isTargetUnInitialized, java.lang.Object source, org.eclipse.persistence.internal.sessions.MergeManager mergeManager, org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
INTERNAL: Merge changes from the source to the target object.- Specified by:
mergeIntoObject
in classDatabaseMapping
-
preInitialize
public void preInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
INTERNAL: Allow for initialization of properties and validation.- Overrides:
preInitialize
in classDatabaseMapping
- Throws:
DescriptorException
-
readFromReturnRowIntoObject
public java.lang.Object readFromReturnRowIntoObject(org.eclipse.persistence.internal.sessions.AbstractRecord row, java.lang.Object object, ReadObjectQuery query, java.util.Collection handledMappings, org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet) throws DatabaseException
INTERNAL: Extracts value from return row and set the attribute to the value in the object. Return row is merged into object after execution of insert or update call according to ReturningPolicy.- Throws:
DatabaseException
-
readFromRowIntoObject
public java.lang.Object readFromRowIntoObject(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, java.lang.Object object, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, ObjectBuildingQuery query, org.eclipse.persistence.internal.sessions.AbstractSession executionSession, boolean isTargetProtected) throws DatabaseException
INTERNAL: Extract value from the row and set the attribute to the value in the object.- Overrides:
readFromRowIntoObject
in classDatabaseMapping
- Throws:
DatabaseException
-
getFieldNameToMethodNameAssociations
public java.util.Vector getFieldNameToMethodNameAssociations()
INTERNAL: Needed for backwards compatibility
-
setFieldNameToMethodNameAssociations
public void setFieldNameToMethodNameAssociations(java.util.Vector associations)
INTERNAL: needed for backwards compatibility
-
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 classDatabaseMapping
-
setAttributeTransformer
public void setAttributeTransformer(AttributeTransformer transformer)
PUBLIC: Set the AttributeTransformer, this transformer will be used to extract the value for the object's attribute from the database row.
-
setAttributeTransformerClassName
public void setAttributeTransformerClassName(java.lang.String className)
INTERNAL: Set the Attribute Transformer Class Name- Parameters:
className
-
-
setAttributeTransformation
public void setAttributeTransformation(java.lang.String methodName)
PUBLIC: To set the attribute method name. The method is invoked internally by TopLink to retrieve the value to store in the domain object. The method receives Record as its parameter and optionally Session, and should extract the value from the record to set into the object, but should not set the value on the object, only return it.
-
setAttributeValueInObject
public void setAttributeValueInObject(java.lang.Object object, java.lang.Object value)
INTERNAL: Check for write-only, one-way transformations.- Overrides:
setAttributeValueInObject
in classDatabaseMapping
-
setIsMutable
public void setIsMutable(boolean mutable)
PUBLIC: Set if the value of the attribute is atomic or a complex mutable object and can be modified without replacing the entire object. This defaults to true for non-primitives, but can be set to false to optimize object cloning and change comparison.
-
setRealAttributeValueInObject
public void setRealAttributeValueInObject(java.lang.Object object, java.lang.Object value) throws DescriptorException
INTERNAL: Set the value of the attribute mapped by this mapping, placing it inside a value holder if necessary. If the value holder is not instantiated then it is instantiated. Check for write-only, one-way transformations.- Overrides:
setRealAttributeValueInObject
in classDatabaseMapping
- Throws:
DescriptorException
-
setFieldTransformations
public void setFieldTransformations(java.util.List<org.eclipse.persistence.internal.descriptors.FieldTransformation> fieldTransformations)
INTERNAL: Set the field to method name associations.
-
setFieldToTransformers
protected void setFieldToTransformers(java.util.List<java.lang.Object[]> fieldToTransformers)
-
setIndirectionPolicy
public void setIndirectionPolicy(org.eclipse.persistence.internal.indirection.IndirectionPolicy indirectionPolicy)
ADVANCED: Set the indirection policy.
-
setUsesIndirection
public void setUsesIndirection(boolean usesIndirection)
INTERNAL: Will be used by Gromit. For details see usesIndirection().- See Also:
useBasicIndirection()
,dontUseIndirection()
-
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 the change record with the new value. This is used by attribute change tracking.- Overrides:
updateChangeRecord
in classDatabaseMapping
-
isChangeTrackingSupported
public boolean isChangeTrackingSupported(Project project)
INTERNAL: Return if this mapping supports change tracking.- Overrides:
isChangeTrackingSupported
in classDatabaseMapping
-
isAttributeValueFromObjectInstantiated
public boolean isAttributeValueFromObjectInstantiated(java.lang.Object object)
INTERNAL: Return whether the specified object is instantiated.- Overrides:
isAttributeValueFromObjectInstantiated
in classDatabaseMapping
-
useBasicIndirection
public void useBasicIndirection()
PUBLIC: Indirection means that a ValueHolder will be put in-between the attribute and the real object. This defaults to false and only required for transformations that perform database access.
-
useContainerIndirection
public void useContainerIndirection(java.lang.Class containerClass)
PUBLIC: Indirection means that a IndirectContainer (wrapping 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.
-
useIndirection
public void useIndirection()
PUBLIC: Indirection means that a ValueHolder will be put in-between the attribute and the real object. This defaults to false and only required for transformations that perform database access.- See Also:
useBasicIndirection()
-
usesIndirection
public boolean usesIndirection()
PUBLIC: Indirection means that a ValueHolder will be put in-between the attribute and the real object. This defaults to false and only required for transformations that perform database access.- See Also:
IndirectionPolicy
-
validateBeforeInitialization
public void validateBeforeInitialization(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
INTERNAL: Validate mapping declaration- Overrides:
validateBeforeInitialization
in classDatabaseMapping
- 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)
INTERNAL: Get a value from the object and set that in the respective field of the row.- Overrides:
valueFromObject
in classDatabaseMapping
-
writeFromObjectIntoRow
public void writeFromObjectIntoRow(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType)
INTERNAL: Get a value from the object and set that in the respective field of the row.- Overrides:
writeFromObjectIntoRow
in classDatabaseMapping
-
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, DatabaseMapping.WriteType writeType)
INTERNAL: Get a value from the object and set that in the respective field of the row.- Overrides:
writeFromObjectIntoRowWithChangeRecord
in classDatabaseMapping
-
writeFromObjectIntoRowForUpdate
public void writeFromObjectIntoRowForUpdate(WriteObjectQuery query, org.eclipse.persistence.internal.sessions.AbstractRecord record)
INTERNAL: Get a value from the object and set that in the respective field of the row. But before that check if the reference object is instantiated or not.- Overrides:
writeFromObjectIntoRowForUpdate
in classDatabaseMapping
-
writeInsertFieldsIntoRow
public void writeInsertFieldsIntoRow(org.eclipse.persistence.internal.sessions.AbstractRecord record, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Write fields needed for insert into the template for with null values.- Overrides:
writeInsertFieldsIntoRow
in classDatabaseMapping
-
-