I have an entity with a composite primary key like this:
{ noformat code:java }@IdClass(MyEntityKey.class) public class MyEntity {
@Id private Long id; @Id private OffsetDateTime bookDate; private String data; } { noformat code }
and the ID-Class
{ noformat code:java }public class MyEntityKey implements Serializable {
private Long id; private OffsetDateTime bookDate; } { noformat code }
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:
{ noformat code:java }em.find(MyEntity.class, new MyEntityKey(ID, BOOK_DATE)); //returns null { noformat code }
but the same as a query works:
{ noformat code:java }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 { noformat code }
I was not able to reproduce this with a [JPAUnitTestCase|https://github.com/hibernate/hibernate-test-case-templates/blob/master/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java], see [discourse|https://discourse.hibernate.org/t/find-idclass-not-working/7804]. |
|