Christian Thiel (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZGE1NmQzMTZl...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16791?atlOrigin=eyJpIjoiZGE1Nm...
) HHH-16791 (
https://hibernate.atlassian.net/browse/HHH-16791?atlOrigin=eyJpIjoiZGE1Nm...
) EntitManager find with IdClass returns null (
https://hibernate.atlassian.net/browse/HHH-16791?atlOrigin=eyJpIjoiZGE1Nm...
)
Issue Type: Bug Affects Versions: 6.2.4 Assignee: Unassigned Attachments:
code-with-quarkus.zip Components: hibernate-core Created: 13/Jun/2023 22:37 PM
Environment: bug in Qurkus 3.1.1 (hibernate-core 6.2.4)
worked in Quarkus 3.0.3 (hibernate-core 6.2.1) Priority: Major Reporter: Christian Thiel (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%...
)
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 (
https://github.com/hibernate/hibernate-test-case-templates/blob/master/or...
) , see discourse (
https://discourse.hibernate.org/t/find-idclass-not-working/7804 ).
(
https://hibernate.atlassian.net/browse/HHH-16791#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16791#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100226- sha1:c25eebb )