In Hibernate 6 entities are selected using JDBC arrays for their key lookup when bach size > 1, the problem is that the JDBC driver could create the array of object to bind by just calling toString() on the instances, and java.sql.Timestamp produces a string representation that is based on the system timezone, which is not necessarily the same timezone as the database failing to retrieve entities by id.
The problem can be worked around by annotating the entity with @BatchSize(size=1), but that is not ideal.
Attached is a reproduction project |
|