Thanks, explicitly setting the dialect to org.hibernate.dialect.OracleDialect instead of letting hibernate auto-detect it (it auto-detects org.hibernate.dialect.H2Dialect) fixes the issue!
Hibernate currently does not officially support H2's Oracle compatibility mode
I suppose this can be closed then, since my problem is caused by an unsupported usecase, correct?
Probably completely unrelated, but just for the record: Using the OracleDialect causes a different issues with timestamps being interpreted in the wrong timezone. I have already set spring.jpa.properties.hibernate.jdbc.time_zone=UTC and am using criteriaBuilder.literal(someOffsetDateTimeWithOffsetZero) in a query. When I set spring.jpa.show-sql=true I see the timestamp being submitted without a time zone, e.g. {{ {ts '2021-01-02 00:00:00.000000'} }} (With the H2 dialect it was e.g. timestamp with time zone '2021-01-02 00:00:00.000000Z'). I was able to work around that issue by additionally setting the H2 timezone using ;TIME ZONE=UTC in the jdbc connection string. |