[hibernate-issues] [JIRA] (HHH-14130) When setting "hibernate.criteria.literal_handling_mode" to "BIND", entities can't be compared to IDs in criteria queries

Erik Lumme (JIRA) jira at hibernate.atlassian.net
Fri Jul 31 03:25:32 EDT 2020


Erik Lumme ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ab6b0f751-008a-4cdc-bcd2-730609c0c5f5 ) *created* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiY2Y1Y2I2MzZlYzU4NDZlNjgyMTUxOGU0MjE2ZjhmZmEiLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-14130?atlOrigin=eyJpIjoiY2Y1Y2I2MzZlYzU4NDZlNjgyMTUxOGU0MjE2ZjhmZmEiLCJwIjoiaiJ9 ) HHH-14130 ( https://hibernate.atlassian.net/browse/HHH-14130?atlOrigin=eyJpIjoiY2Y1Y2I2MzZlYzU4NDZlNjgyMTUxOGU0MjE2ZjhmZmEiLCJwIjoiaiJ9 ) When setting "hibernate.criteria.literal_handling_mode" to "BIND", entities can't be compared to IDs in criteria queries ( https://hibernate.atlassian.net/browse/HHH-14130?atlOrigin=eyJpIjoiY2Y1Y2I2MzZlYzU4NDZlNjgyMTUxOGU0MjE2ZjhmZmEiLCJwIjoiaiJ9 )

Issue Type: Bug Affects Versions: 5.4.18 Assignee: Unassigned Components: hibernate-core Created: 31/Jul/2020 00:25 AM Priority: Minor Reporter: Erik Lumme ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ab6b0f751-008a-4cdc-bcd2-730609c0c5f5 )

Consider an entity with an ID of type Long. An entity can be found based on it's ID in a criteria query using a construct such as this

{{Root<TestEntity> root = cq.from(TestEntity.class);
cq.where(root.in(1, 2, 3));}}

However, when setting hibernate.criteria.literal_handling_mode to BIND , this no longer works, but results in the error:

java.lang.IllegalArgumentException: Parameter value [1] did not match expected type [org.hibernate.bugs.TestEntity (n/a)]

Test case can be found on GitHub ( https://github.com/eriklumme/hibernate-bind-test/blob/master/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java ). The test case hhhTest_works passes, and hhhTest_fails fails.

( https://hibernate.atlassian.net/browse/HHH-14130#add-comment?atlOrigin=eyJpIjoiY2Y1Y2I2MzZlYzU4NDZlNjgyMTUxOGU0MjE2ZjhmZmEiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-14130#add-comment?atlOrigin=eyJpIjoiY2Y1Y2I2MzZlYzU4NDZlNjgyMTUxOGU0MjE2ZjhmZmEiLCJwIjoiaiJ9 )

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.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100140- sha1:33445dc )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200731/2dfe715f/attachment.html 


More information about the hibernate-issues mailing list