Interface VersionJavaType<T>

All Superinterfaces:
JavaType<T>, Serializable
All Known Implementing Classes:
ByteJavaType, CalendarJavaType, DateJavaType, InstantJavaType, IntegerJavaType, JdbcTimestampJavaType, LocalDateTimeJavaType, LongJavaType, OffsetDateTimeJavaType, PrimitiveByteArrayJavaType, ShortJavaType, UserTypeVersionJavaTypeWrapper, ZonedDateTimeJavaType

public interface VersionJavaType<T> extends JavaType<T>
Additional contract for types which may be used to version (and optimistic lock) data.
  • Method Details

    • seed

      T seed(Long length, Integer precision, Integer scale, SharedSessionContractImplementor session)
      Generate an initial version.

      Note that this operation is only used when the program sets a null or negative number as the value of the entity version field. It is not called when the program sets the version field to a sensible-looking version.

      Parameters:
      length - The length of the type
      precision - The precision of the type
      scale - The scale of the type
      session - The session from which this request originates.
      Returns:
      an instance of the type
    • next

      T next(T current, Long length, Integer precision, Integer scale, SharedSessionContractImplementor session)
      Increment the version.
      Parameters:
      current - the current version
      length - The length of the type
      precision - The precision of the type
      scale - The scale of the type
      session - The session from which this request originates.
      Returns:
      an instance of the type