Since Hibernate 6, Version annotation does not work well with OffsetDatetime on postgresql due to the control
if ( !entry.getVersion().equals( latestVersion ) )
made in EntityVerifyVersionProcess Method “equals” on OffsetDatetime checks if Offset and Datetime are equals. OffsetDateTime exposes 2 methods:
- equals : checks the strict equality (localdatetime AND offset)
- isEquals: checks that both date are semantically the same (ie: same instant)
IMHO EntityVerifyVersionProcess should use isEquals to compare equality between 2 OffsetDateTime. In our case, the problem arises because our postgresql server is using UTC while our java application is deployed on a server with another timezone. |