Module eclipselink

Class TimestampLockingPolicy

All Implemented Interfaces:
Serializable, Cloneable, org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy

public class TimestampLockingPolicy extends AbstractTsLockingPolicy<Timestamp>

Purpose: Used to allow a single version timestamp to be used for optimistic locking.

See Also:
  • Constructor Details

    • TimestampLockingPolicy

      public TimestampLockingPolicy()
      Create a new TimestampLockingPolicy. Defaults to using the time retrieved from the server.
    • TimestampLockingPolicy

      public TimestampLockingPolicy(String fieldName)
      Create a new TimestampLockingPolicy. Defaults to using the time retrieved from the server.
      Parameters:
      fieldName - the field where the write lock value will be stored
  • Method Details

    • getVersionDifference

      public int getVersionDifference(Object currentValue, Object domainObject, Object primaryKeys, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: Return the number of versions different between these objects.
      Specified by:
      getVersionDifference in interface org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy
      Overrides:
      getVersionDifference in class VersionLockingPolicy
      Parameters:
      currentValue - the new lock value
      domainObject - the object containing the version to be compared to
      primaryKeys - a vector containing the primary keys of the domainObject
      session - the session to be used with the comparison