Class UnidirectionalOneToManyMapping

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, ContainerMapping, MapComponentMapping, RelationalMapping

public class UnidirectionalOneToManyMapping extends OneToManyMapping

Purpose: UnidirectionalOneToManyMapping doesn't have 1:1 back reference mapping.

See Also:
Author:
Andrei Ilitchev
  • Field Details

    • shouldIncrementTargetLockValueOnAddOrRemoveTarget

      protected boolean shouldIncrementTargetLockValueOnAddOrRemoveTarget
      Indicates whether target's optimistic locking value should be incremented on target being added to / removed from a source.
    • shouldIncrementTargetLockValueOnDeleteSource

      protected boolean shouldIncrementTargetLockValueOnDeleteSource
      Indicates whether target's optimistic locking value should be incremented on the source deletion. Note that if the flag is set to true then the indirection will be triggered on source delete - in order to verify all targets' versions.
  • Constructor Details

    • UnidirectionalOneToManyMapping

      public UnidirectionalOneToManyMapping()
      PUBLIC: Default constructor.
  • Method Details

    • buildKeyRowForTargetUpdate

      protected org.eclipse.persistence.internal.sessions.AbstractRecord buildKeyRowForTargetUpdate(ObjectLevelModifyQuery query)
      INTERNAL: Build a row containing the keys for use in the query that updates the row for the target object during an insert or update
      Overrides:
      buildKeyRowForTargetUpdate in class OneToManyMapping
    • 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 uow)
      INTERNAL: This method is used to create a change record from comparing two collections
      Overrides:
      compareForChange in class CollectionMapping
      Returns:
      org.eclipse.persistence.internal.sessions.ChangeRecord
    • extractSourceKeyFromRow

      protected Vector extractSourceKeyFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: Extract the source primary key value from the target row. Used for batch reading, most following same order and fields as in the mapping.
    • isOwned

      public boolean isOwned()
      INTERNAL:
      Overrides:
      isOwned in class DatabaseMapping
    • isUnidirectionalOneToManyMapping

      public boolean isUnidirectionalOneToManyMapping()
      INTERNAL:
      Overrides:
      isUnidirectionalOneToManyMapping in class DatabaseMapping
    • initialize

      public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
      INTERNAL: Initialize the mapping.
      Overrides:
      initialize in class OneToManyMapping
      Throws:
      DescriptorException
    • postInitialize

      public void postInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
      Initialize the type of the target foreign key, as it will be null as it is not mapped in the target.
      Overrides:
      postInitialize in class CollectionMapping
    • createModifyRowForAddTargetQuery

      protected org.eclipse.persistence.internal.sessions.AbstractRecord createModifyRowForAddTargetQuery()
      INTERNAL:
      Overrides:
      createModifyRowForAddTargetQuery in class OneToManyMapping
    • preDelete

      public void preDelete(DeleteObjectQuery query) throws DatabaseException, OptimisticLockException
      INTERNAL: Delete the reference objects.
      Overrides:
      preDelete in class OneToManyMapping
      Throws:
      DatabaseException
      OptimisticLockException
    • prepareCascadeLockingPolicy

      public void prepareCascadeLockingPolicy()
      Prepare a cascade locking policy.
      Overrides:
      prepareCascadeLockingPolicy in class OneToManyMapping
    • postCalculateChanges

      public void postCalculateChanges(ChangeRecord changeRecord, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
      INTERNAL: Overridden by mappings that require additional processing of the change record after the record has been calculated.
      Overrides:
      postCalculateChanges in class CollectionMapping
    • postCalculateChangesOnDeleted

      public void postCalculateChangesOnDeleted(Object deletedObject, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet uowChangeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
      INTERNAL: Overridden by mappings that require objects to be deleted contribute to change set creation.
      Overrides:
      postCalculateChangesOnDeleted in class DatabaseMapping
    • postPrepareNestedBatchQuery

      protected void postPrepareNestedBatchQuery(ReadQuery batchQuery, ObjectLevelReadQuery query)
      INTERNAL: Add additional fields
      Overrides:
      postPrepareNestedBatchQuery in class CollectionMapping
    • prepareTranslationRow

      protected void prepareTranslationRow(org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, Object object, ClassDescriptor descriptor, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: The translation row may require additional fields than the primary key if the mapping in not on the primary key.
      Overrides:
      prepareTranslationRow in class CollectionMapping
    • recordPrivateOwnedRemovals

      public void recordPrivateOwnedRemovals(Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
      INTERNAL: Overridden by mappings that require additional processing of the change record after the record has been calculated.
      Overrides:
      recordPrivateOwnedRemovals in class CollectionMapping
    • requiresDataModificationEvents

      public boolean requiresDataModificationEvents()
      INTERNAL: UnidirectionalOneToManyMapping performs some events after INSERT/UPDATE to maintain the keys
      Overrides:
      requiresDataModificationEvents in class OneToManyMapping
      Returns:
      See Also:
    • setShouldIncrementTargetLockValueOnAddOrRemoveTarget

      public void setShouldIncrementTargetLockValueOnAddOrRemoveTarget(boolean shouldIncrementTargetLockValueOnAddOrRemoveTarget)
      PUBLIC: Set value that indicates whether target's optimistic locking value should be incremented on target being added to / removed from a source (default value is true).
    • setShouldIncrementTargetLockValueOnDeleteSource

      public void setShouldIncrementTargetLockValueOnDeleteSource(boolean shouldIncrementTargetLockValueOnDeleteSource)
      PUBLIC: Set value that indicates whether target's optimistic locking value should be incremented on the source deletion (default value is true).
    • shouldIncrementTargetLockValueOnAddOrRemoveTarget

      public boolean shouldIncrementTargetLockValueOnAddOrRemoveTarget()
      PUBLIC: Indicates whether target's optimistic locking value should be incremented on target being added to / removed from a source (default value is true).
    • shouldIncrementTargetLockValueOnDeleteSource

      public boolean shouldIncrementTargetLockValueOnDeleteSource()
      PUBLIC: Indicates whether target's optimistic locking value should be incremented on the source deletion (default value is true).
    • shouldRemoveTargetQueryModifyTargetForeignKey

      protected boolean shouldRemoveTargetQueryModifyTargetForeignKey()
      INTERNAL Target foreign key of the removed object should be modified (set to null).
      Overrides:
      shouldRemoveTargetQueryModifyTargetForeignKey in class OneToManyMapping
    • shouldDeferInsert

      public boolean shouldDeferInsert()
      Overrides:
      shouldDeferInsert in class OneToManyMapping