Clemens Rüttermann (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYTE0N2JjMDlm...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-17006?atlOrigin=eyJpIjoiYTE0N2...
) HHH-17006 (
https://hibernate.atlassian.net/browse/HHH-17006?atlOrigin=eyJpIjoiYTE0N2...
) Query for enum with IS NULL fails with NullPointerException
(org.hibernate.metamodel.mapping.JdbcMapping.getJdbcValueBinder()) (
https://hibernate.atlassian.net/browse/HHH-17006?atlOrigin=eyJpIjoiYTE0N2...
)
Issue Type: Bug Affects Versions: 6.0.0, 6.2.7 Assignee: Unassigned Created: 27/Jul/2023
03:14 AM Priority: Major Reporter: Clemens Rüttermann (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%...
)
When creating a query with an enum as a parameter hibernate fails with the following
exception
java.lang.NullPointerException: Cannot invoke
"org.hibernate.metamodel.mapping.JdbcMapping.getJdbcValueBinder()" because
"jdbcMapping" is null
This is a sample code to reproduce the bug:
Query query = entityManager.createQuery("SELECT t from TestTbl AS t WHERE t.testEnum
IS NULL AND :testEnum IS NULL");
query.setParameter("testEnum", TestEnum.VALUE_1);
query.getResultList();
Also I created two repositories for Hibernate 5 and Hibernate 6 which show that this
worked in Hibernate 5 but is failing in Hibernate 6:
https://github.com/TheChronicler/hibernate5_enum_test_case/tree/master
https://github.com/TheChronicler/hibernate6_enum_test_case
Note that the exception is only thrown when the parameter is set to a value other than
null
(
https://hibernate.atlassian.net/browse/HHH-17006#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-17006#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#100233- sha1:63d45e1 )