Class AbstractInstantId<E,​I>

    • Method Detail

      • getVersion

        public Instant getVersion()
        Specified by:
        getVersion in interface Id<E>
        Specified by:
        getVersion in class AbstractId<E,​I,​Instant>
        Returns:
        the version of this entity. Whenever the Entity gets updated (a modification is saved and the transaction is committed), this version is increased. Typically the version is a Number starting with 0 for a new Entity that is increased whenever a modification is committed. However, it may also be an Instant. The version acts as a modification sequence for optimistic locking. On each update it will be verified that the version has not been increased already by another transaction. When linking an Entity (Id used as foreign key) the version can act as revision for auditing. If it is Id.VERSION_LATEST (null) it points to the latest revision of the Entity. Otherwise it points to a specific historic revision of the Entity. Depending on the database technology (e.g. when using hibernate envers) the version and the revision can be semantically different. In such case a primary key can not be converted 1:1 as revisioned foreign key Id.