Does anyone know why using H2 on Java 15+ and Spring/Hibernate with entitys 
that are versioned using timestamps require a precision of 9 instead of 6?

We upgraded our web app to use Java 17. Since Java 15+ the JDK/JRE support 
nanosecond precision for datetime objects. Our integration tests use H2 
version 1.4.200. 

It seems I have needed to change our entities from:
@Version
@Column(columnDefinition = “DATETIME(6)”)
private Instant version;
To:
@Version
@Column(columnDefinition = “DATETIME(9)”)
private Instant version;

Otherwise I will get optimistic locking failed; nested exception is 
org.hibernate.StaleObjectStateException

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/3cc47ed7-e94c-4195-813d-2b8e51d1d9fcn%40googlegroups.com.

Reply via email to