| If we use the entity @Version, the "unsaved-value" is no longer necessary. One example is when you try to combine a sequence identifier generator with an assigned generator (e.g. if the id is null, then the sequence should be called, otherwise just use the assigned value). If we define a @Version property that is nullable (e.g. private @Version Long version), then Hibernate will use that do determine if the entity is unsaved even if the identifier is set. All in all, the nullable @Version property is the "unsaved-value" annotation equivalent. |