Christian Thiel (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNjliYmM4MGE2...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16791?atlOrigin=eyJpIjoiNjliYm...
) HHH-16791 (
https://hibernate.atlassian.net/browse/HHH-16791?atlOrigin=eyJpIjoiNjliYm...
) EntitManager find with IdClass returns null (
https://hibernate.atlassian.net/browse/HHH-16791?atlOrigin=eyJpIjoiNjliYm...
)
Change By: Christian Thiel (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%...
)
I have an entity with a composite primary key like this:
{ noformat code:java }(a)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-template...],
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 )