Class AbstractDirectMapping

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>
All Implemented Interfaces:
Serializable, Cloneable, MapComponentMapping, MapKeyMapping
Direct Known Subclasses:
DirectToFieldMapping, EISDirectMapping, XMLDirectMapping

public abstract class AbstractDirectMapping extends AbstractColumnMapping 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:
Author:
Sati
  • Field Details

    • attributeClassification

      protected transient Class attributeClassification
      To specify the conversion type
    • attributeClassificationName

      protected String attributeClassificationName
    • attributeObjectClassification

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

      protected transient Object nullValue
      Support specification of the value to use for null.
    • keyTableForMapKey

      protected org.eclipse.persistence.internal.helper.DatabaseTable keyTableForMapKey
    • fieldClassificationClassName

      protected String fieldClassificationClassName
    • bypassDefaultNullValueCheck

      protected boolean bypassDefaultNullValueCheck
      PERF: Avoid default null value conversion check if not default null value set in conversion manager.
    • isMutable

      protected 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 Details

    • AbstractDirectMapping

      public AbstractDirectMapping()
      Default constructor.
  • Method Details

    • addAdditionalFieldsToQuery

      public void addAdditionalFieldsToQuery(ReadQuery selectionQuery, Expression baseExpression)
      INTERNAL: Used when initializing queries for mappings that use a Map. Called when the selection query is being initialized to add the fields for the map key to the query.
      Specified by:
      addAdditionalFieldsToQuery in interface MapKeyMapping
    • addFieldsForMapKey

      public void addFieldsForMapKey(org.eclipse.persistence.internal.sessions.AbstractRecord joinRow)
      INTERNAL: Used when initializing queries for mappings that use a Map Called when the insert query is being initialized to ensure the fields for the map key are in the insert query.
      Specified by:
      addFieldsForMapKey in interface MapKeyMapping
    • addKeyToDeletedObjectsList

      public void addKeyToDeletedObjectsList(Object object, Map deletedObjects)
      INTERNAL: For mappings used as MapKeys in MappedKeyContainerPolicy. Add the target of this mapping to the deleted objects list if necessary This method is used for removal of private owned relationships DirectMappings are dealt with in their parent delete, so this is a no-op.
      Specified by:
      addKeyToDeletedObjectsList in interface MapKeyMapping
    • 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(Object clone, 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
    • buildChangeRecord

      public org.eclipse.persistence.internal.sessions.ChangeRecord buildChangeRecord(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
    • buildClone

      public void buildClone(Object original, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, Object clone, 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 class DatabaseMapping
    • buildCloneFromRow

      public void buildCloneFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, 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 class DatabaseMapping
    • buildCloneValue

      public void buildCloneValue(Object original, 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).
    • buildCloneValue

      protected Object buildCloneValue(Object attributeValue, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: Clone the actual value represented by this mapping. Do set the cloned value into the object.
    • buildCopy

      public void buildCopy(Object copy, 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 class DatabaseMapping
    • buildElementClone

      public Object buildElementClone(Object attributeValue, Object parent, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, Integer refreshCascade, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession, boolean isExisting, boolean isFromSharedCache)
      Build a clone of the given element in a unitOfWork.
      Specified by:
      buildElementClone in interface MapKeyMapping
      Returns:
    • buildExpression

      public Expression buildExpression(Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, 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
    • buildSelectionQueryForDirectCollectionKeyMapping

      public ReadQuery buildSelectionQueryForDirectCollectionKeyMapping(org.eclipse.persistence.internal.queries.ContainerPolicy containerPolicy)
      INTERNAL: Certain key mappings favor different types of selection query. Return the appropriate type of selectionQuery.
      Specified by:
      buildSelectionQueryForDirectCollectionKeyMapping in interface MapKeyMapping
      Returns:
    • cascadeDiscoverAndPersistUnregisteredNewObjects

      public void cascadeDiscoverAndPersistUnregisteredNewObjects(Object object, Map newObjects, Map unregisteredExistingObjects, Map visitedObjects, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, boolean getAttributeValueFromObject, Set cascadeErrors)
      INTERNAL: Cascade discover and persist new objects during commit to the map key.
      Specified by:
      cascadeDiscoverAndPersistUnregisteredNewObjects in interface MapKeyMapping
    • cascadePerformRemoveIfRequired

      public void cascadePerformRemoveIfRequired(Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, Map visitedObjects, boolean getAttributeValueFromObject)
      INTERNAL: Cascade perform delete through mappings that require the cascade.
      Specified by:
      cascadePerformRemoveIfRequired in interface MapKeyMapping
    • cascadePerformRemoveIfRequired

      public void cascadePerformRemoveIfRequired(Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, Map visitedObjects)
      INTERNAL: Cascade perform delete through mappings that require the cascade.
      Overrides:
      cascadePerformRemoveIfRequired in class AbstractColumnMapping
    • cascadeRegisterNewIfRequired

      public void cascadeRegisterNewIfRequired(Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, Map visitedObjects, boolean getAttributeValueFromObject)
      INTERNAL: Cascade registerNew for Create through mappings that require the cascade.
      Specified by:
      cascadeRegisterNewIfRequired in interface MapKeyMapping
    • cascadeRegisterNewIfRequired

      public void cascadeRegisterNewIfRequired(Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, Map visitedObjects)
      INTERNAL: Cascade registerNew for Create through mappings that require the cascade.
      Overrides:
      cascadeRegisterNewIfRequired in class AbstractColumnMapping
    • compareForChange

      public org.eclipse.persistence.internal.sessions.ChangeRecord compareForChange(Object clone, 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
    • deleteMapKey

      public void deleteMapKey(Object objectDeleted, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: For mappings used as MapKeys in MappedKeyContainerPolicy, Delete the passed object if necessary. This method is used for removal of private owned relationships DirectMappings are dealt with in their parent delete, so this is a no-op.
      Specified by:
      deleteMapKey in interface MapKeyMapping
    • compareObjects

      public boolean compareObjects(Object firstObject, 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(Object firstValue, Object secondValue, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: Compare the attribute values.
    • convertClassNamesToClasses

      public void convertClassNamesToClasses(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 AbstractColumnMapping
    • createSerializableMapKeyInfo

      public Object createSerializableMapKeyInfo(Object key, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: Creates the Array of simple types used to recreate this map.
      Specified by:
      createSerializableMapKeyInfo in interface MapKeyMapping
    • createMapComponentsFromSerializableKeyInfo

      public List<Object> createMapComponentsFromSerializableKeyInfo(Object[] keyInfo, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: Create an instance of the Key object from the key information extracted from the map. This may return the value directly in case of a simple key or will be used as the FK to load a related entity.
      Specified by:
      createMapComponentsFromSerializableKeyInfo in interface MapKeyMapping
    • createStubbedMapComponentFromSerializableKeyInfo

      public Object createStubbedMapComponentFromSerializableKeyInfo(Object keyInfo, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: Create an instance of the Key object from the key information extracted from the map. This key object may be a shallow stub of the actual object if the key is an Entity type.
      Specified by:
      createStubbedMapComponentFromSerializableKeyInfo in interface MapKeyMapping
    • createMapComponentFromRow

      public Object createMapComponentFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord dbRow, ObjectBuildingQuery query, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, org.eclipse.persistence.internal.sessions.AbstractSession session, boolean isTargetProtected)
      INTERNAL Called when a DatabaseMapping is used to map the key in a collection. Returns the key.
      Specified by:
      createMapComponentFromRow in interface MapComponentMapping
    • createMapComponentFromJoinedRow

      public Object createMapComponentFromJoinedRow(org.eclipse.persistence.internal.sessions.AbstractRecord dbRow, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManger, ObjectBuildingQuery query, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, org.eclipse.persistence.internal.sessions.AbstractSession session, boolean isTargetProtected)
      INTERNAL Called when a DatabaseMapping is used to map the key in a collection and a join query is executed. Returns the key.
      Specified by:
      createMapComponentFromJoinedRow in interface MapKeyMapping
    • createQueryKeyForMapKey

      public QueryKey createQueryKeyForMapKey()
      INTERNAL: Create a query key that links to the map key.
      Specified by:
      createQueryKeyForMapKey in interface MapKeyMapping
      Returns:
    • extractIdentityFieldsForQuery

      public Map extractIdentityFieldsForQuery(Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: Extract the fields for the Map key from the object to use in a query.
      Specified by:
      extractIdentityFieldsForQuery in interface MapKeyMapping
      Returns:
    • getAdditionalTablesForJoinQuery

      public List<org.eclipse.persistence.internal.helper.DatabaseTable> getAdditionalTablesForJoinQuery()
      INTERNAL: Return any tables that will be required when this mapping is used as part of a join query.
      Specified by:
      getAdditionalTablesForJoinQuery in interface MapKeyMapping
      Returns:
    • getAttributeClassification

      public 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 String getAttributeClassificationName()
      INTERNAL: Return the class name of the attribute type. This is only used by the MW.
    • getObjectValue

      public Object getObjectValue(Object fieldValue, Session session)
      INTERNAL: Allows for subclasses to convert the attribute value.
      Specified by:
      getObjectValue in class AbstractColumnMapping
    • getObjectValueWithoutClassCheck

      public Object getObjectValueWithoutClassCheck(Object fieldValue, Session session)
      INTERNAL: Same as getObjectValue method, but without checking fieldValue's class. Used in case the fieldValue class is already known to be the same as attributeClassification.
    • isAbstractDirectMapping

      public boolean isAbstractDirectMapping()
      INTERNAL:
      Overrides:
      isAbstractDirectMapping in class DatabaseMapping
    • getReferenceDescriptor

      public ClassDescriptor getReferenceDescriptor()
      INTERNAL: Get the descriptor for this mapping This method is potentially called when this mapping is used as a map key and will return null since direct mappings do not have reference descriptors.
      Specified by:
      getReferenceDescriptor in interface MapKeyMapping
      Overrides:
      getReferenceDescriptor in class DatabaseMapping
      Returns:
    • getFieldClassification

      public 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 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(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.
    • setFieldClassificationClassName

      public void setFieldClassificationClassName(String className)
      INTERNAL: Set the name of the class that will be used for setFieldClassification and deploy time Used internally by JPA deployment.
      Parameters:
      className -
      See Also:
    • 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 String getFieldName()
      PUBLIC: Name of the field this mapping represents.
    • getFieldValue

      public Object getFieldValue(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.
      Specified by:
      getFieldValue in class AbstractColumnMapping
    • getForeignKeyFieldsForMapKey

      public Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getForeignKeyFieldsForMapKey()
      INTERNAL: Return a Map of any foreign keys defined within the the MapKey.
      Specified by:
      getForeignKeyFieldsForMapKey in interface MapKeyMapping
      Returns:
    • getIdentityFieldsForMapKey

      public List<org.eclipse.persistence.internal.helper.DatabaseField> getIdentityFieldsForMapKey()
      INTERNAL: Return the fields that make up the identity of the mapped object. For mappings with a primary key, it will be the set of fields in the primary key. For mappings without a primary key it will likely be all the fields.
      Specified by:
      getIdentityFieldsForMapKey in interface MapKeyMapping
      Returns:
    • getAllFieldsForMapKey

      public List<org.eclipse.persistence.internal.helper.DatabaseField> getAllFieldsForMapKey()
      INTERNAL: Get all the fields for the map key.
      Specified by:
      getAllFieldsForMapKey in interface MapKeyMapping
    • getNestedJoinQuery

      public ObjectLevelReadQuery getNestedJoinQuery(org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectLevelReadQuery query, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: Return the query that is used when this mapping is part of a joined relationship This method is used when this mapping is used to map the key in a Map.
      Specified by:
      getNestedJoinQuery in interface MapKeyMapping
      Returns:
    • getNullValue

      public 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
    • getAdditionalSelectionCriteriaForMapKey

      public Expression getAdditionalSelectionCriteriaForMapKey()
      INTERNAL: Return the selection criteria necessary to select the target object when this mapping is a map key. DirectMappings do not need any additional selection criteria when they are map keys.
      Specified by:
      getAdditionalSelectionCriteriaForMapKey in interface MapKeyMapping
      Returns:
    • getTargetVersionOfSourceObject

      public Object getTargetVersionOfSourceObject(Object object, Object parent, org.eclipse.persistence.internal.sessions.MergeManager mergeManager, org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
      INTERNAL: If required, get the targetVersion of the source object from the merge manager. Used with MapKeyContainerPolicy to abstract getting the target version of a source key.
      Specified by:
      getTargetVersionOfSourceObject in interface MapKeyMapping
      Returns:
    • getMapKeyTargetType

      public Class getMapKeyTargetType()
      INTERNAL: Return the class this key mapping maps or the descriptor for it
      Specified by:
      getMapKeyTargetType in interface MapKeyMapping
      Returns:
    • getWeight

      public 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
    • 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
    • internalBuildChangeRecord

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

      public boolean isDirectToFieldMapping()
      INTERNAL:
      Overrides:
      isDirectToFieldMapping in class DatabaseMapping
    • iterateOnMapKey

      public void iterateOnMapKey(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator, Object element)
      INTERNAL: Called when iterating through descriptors to handle iteration on this mapping when it is used as a MapKey.
      Specified by:
      iterateOnMapKey in interface MapKeyMapping
    • mergeChangesIntoObject

      public void mergeChangesIntoObject(Object target, org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, 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:
      mergeChangesIntoObject in class DatabaseMapping
    • mergeIntoObject

      public void mergeIntoObject(Object target, boolean isTargetUnInitialized, 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. 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
    • preinitializeMapKey

      public void preinitializeMapKey(org.eclipse.persistence.internal.helper.DatabaseTable table) throws DescriptorException
      INTERNAL: Making any mapping changes necessary to use a the mapping as a map key prior to initializing the mapping.
      Specified by:
      preinitializeMapKey in interface MapKeyMapping
      Throws:
      DescriptorException
    • postInitializeMapKey

      public void postInitializeMapKey(org.eclipse.persistence.internal.queries.MappedKeyMapContainerPolicy policy)
      INTERNAL: Making any mapping changes necessary to use a the mapping as a map key after initializing the mapping.
      Specified by:
      postInitializeMapKey in interface MapKeyMapping
    • requiresDataModificationEventsForMapKey

      public boolean requiresDataModificationEventsForMapKey()
      INTERNAL: Return whether this mapping requires extra queries to update the rows if it is used as a key in a map. This will typically be true if there are any parts to this mapping that are not read-only.
      Specified by:
      requiresDataModificationEventsForMapKey in interface MapKeyMapping
    • setAttributeClassification

      public void setAttributeClassification(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 EclipseLink to force the instance variable value to that data type
    • setAttributeClassificationName

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

      public void setNullValue(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 String toString()
      INTERNAL:
      Overrides:
      toString in class AbstractColumnMapping
    • updateChangeRecord

      public void updateChangeRecord(Object clone, Object newValue, 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
    • unwrapKey

      public Object unwrapKey(Object key, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: Allow the key mapping to unwrap the object.
      Specified by:
      unwrapKey in interface MapKeyMapping
      Returns:
    • 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
    • wrapKey

      public Object wrapKey(Object key, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: Allow the key mapping to wrap the object.
      Specified by:
      wrapKey in interface MapKeyMapping
      Returns:
    • valueFromObject

      public Object valueFromObject(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
    • buildShallowOriginalFromRow

      public void buildShallowOriginalFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, 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
      Parameters:
      original - later the input to buildCloneFromRow
    • valueFromRow

      public Object valueFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery query, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, org.eclipse.persistence.internal.sessions.AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed)
      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 Object valueFromResultSet(ResultSet resultSet, ObjectBuildingQuery query, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor accessor, ResultSetMetaData metaData, int columnNumber, org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform) throws SQLException
      INTERNAL: Returns the value for the mapping directly from the result-set. PERF: Used for optimized object building.
      Overrides:
      valueFromResultSet in class DatabaseMapping
      Throws:
      SQLException
    • writeValueIntoRow

      protected abstract void writeValueIntoRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.helper.DatabaseField field, Object value)
      Description copied from class: AbstractColumnMapping
      INTERNAL:
      Specified by:
      writeValueIntoRow in class AbstractColumnMapping
    • 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. Validation preventing primary key updates is implemented here.
      Overrides:
      writeFromObjectIntoRowWithChangeRecord in class DatabaseMapping
    • writeFromObjectIntoRow

      public void writeFromObjectIntoRow(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 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
    • writeUpdateFieldsIntoRow

      public void writeUpdateFieldsIntoRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: Write fields needed for update into the template for with null values. By default inserted fields are used.
      Overrides:
      writeUpdateFieldsIntoRow in class DatabaseMapping
    • getFieldClassificationClassName

      public String getFieldClassificationClassName()
      INTERNAL: Get fieldClassificationClassName. Value usually exist for fields with some kind of embedded converter like @Lob or @Temporal.