Class MultitenantPrimaryKeyMapping

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

public class MultitenantPrimaryKeyMapping extends AbstractColumnMapping
Purpose: Maps a multitenant property 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.
See Also:
Author:
Guy Pelletier
  • Constructor Details

    • MultitenantPrimaryKeyMapping

      public MultitenantPrimaryKeyMapping()
      Constructor
  • Method Details

    • 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. This is an override from DatabaseMapping and must be implemented.
      Specified by:
      buildBackupClone 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. This is an override from DatabaseMapping and must be implemented.
      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
    • 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. This is an override from DatabaseMapping and must be implemented.
      Specified by:
      compareForChange in class DatabaseMapping
      Returns:
      prototype.changeset.ChangeRecord
    • 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. This is an override from DatabaseMapping and must be implemented.
      Specified by:
      compareObjects in class DatabaseMapping
    • getFieldValue

      public Object getFieldValue(Object propertyValue, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL:
      Specified by:
      getFieldValue in class AbstractColumnMapping
    • getObjectValue

      public Object getObjectValue(Object fieldValue, Session session)
      INTERNAL:
      Specified by:
      getObjectValue in class AbstractColumnMapping
    • 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
    • isCloningRequired

      public boolean isCloningRequired()
      INTERNAL: Return if this mapping requires its attribute value to be cloned.
      Overrides:
      isCloningRequired in class DatabaseMapping
    • isMultitenantPrimaryKeyMapping

      public boolean isMultitenantPrimaryKeyMapping()
      INTERNAL
      Overrides:
      isMultitenantPrimaryKeyMapping in class DatabaseMapping
    • isRelationalMapping

      public boolean isRelationalMapping()
      INTERNAL:
      Overrides:
      isRelationalMapping in class DatabaseMapping
    • isWriteOnly

      public boolean isWriteOnly()
      INTERNAL This mapping must be write only as their is no attribute to read into.
      Overrides:
      isWriteOnly in class DatabaseMapping
    • 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. This is an override from DatabaseMapping and must be implemented.
      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 This is an override from DatabaseMapping and must be implemented.
      Specified by:
      mergeIntoObject in class DatabaseMapping
    • setContextProperty

      public void setContextProperty(String contextProperty)
      INTERNAL: The context property that is used to write this mapping must be set. It is set as the attribute name (which gets set on the accessor)
    • 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
    • valueFromObject

      public Object valueFromObject(Object anObject, org.eclipse.persistence.internal.helper.DatabaseField field, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: Return the Value from the object.
      Overrides:
      valueFromObject 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
    • writeValueIntoRow

      protected void writeValueIntoRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.helper.DatabaseField field, Object fieldValue)
      INTERNAL:
      Specified by:
      writeValueIntoRow in class AbstractColumnMapping