EntitManager#find with IdClass with OffsetDateTime field returns null when Batch is enabled

Description

I have an entity with a composite primary key like this:

@IdClass(MyEntityKey.class) public class MyEntity { @Id private Long id; @Id private OffsetDateTime bookDate; private String data; }

and the ID-Class

public class MyEntityKey implements Serializable { private Long id; private OffsetDateTime bookDate; }

After upgrading from hibernate-core from 6.2.1 to 6.2.4 (actually upgrade from Quarkus 3.0.3 to 3.1.1) the em.find() no longer works, but returns `null:

em.find(MyEntity.class, new MyEntityKey(ID, BOOK_DATE)); //returns null

but the same as a query works:

em .createQuery("SELECT x FROM MyEntity x WHERE x.id = :id AND x.bookDate = :bookDate", MyEntity.class) .setParameter("id", ID) .setParameter("bookDate", BOOK_DATE) .getResultList(); //returns the value

 

I was not able to reproduce this with a JPAUnitTestCase, see discourse.

Attachments

1
  • 14 Jun 2023, 05:36 AM

Activity

Show:

Details

Assignee

Reporter

Worked in

Components

Sprint

Affects versions

Priority

Created June 14, 2023 at 5:37 AM
Updated October 21, 2024 at 1:43 PM