We have a Java object annotated with @Column (columnDefinition = 
"DATETIME(6)") and this has usually worked fine with our production app 
using MySQL.

However, we are upgrading to Java 17, and now notice that on Linux-based OS 
that nanoseconds precision is default. In addition to this, we are using 
Hibernate ORM and the infamous Optimistic Lock by annotating the column 
with @Version.

Our integration tests fail with H2 because there is a mismatch in precision 
between storing DATETIME(6) but the system/JVM using nanoseconds precision.

My question is whether there is any way to override the columnDefinition to 
update the precision to 9 when running our integration tests with the H2 
database, but keeping the precision of 6 for when we run our app in 
production with MySQL?

-- 
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/912af26c-d879-4c62-acf6-d40829f43f49n%40googlegroups.com.

Reply via email to