[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:28:37 EDT 2020


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

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMzQyNzEwZjAyMzBkNDU4MzgxOTY2Mzk5NjAzODNiNGYiLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-14130?atlOrigin=eyJpIjoiMzQyNzEwZjAyMzBkNDU4MzgxOTY2Mzk5NjAzODNiNGYiLCJwIjoiaiJ9 ) HHH-14130 ( https://hibernate.atlassian.net/browse/HHH-14130?atlOrigin=eyJpIjoiMzQyNzEwZjAyMzBkNDU4MzgxOTY2Mzk5NjAzODNiNGYiLCJwIjoiaiJ9 ) 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=eyJpIjoiMzQyNzEwZjAyMzBkNDU4MzgxOTY2Mzk5NjAzODNiNGYiLCJwIjoiaiJ9 )

Change By: 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

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

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 hhh14130_test_works }} passes, and {{ hhhTest_fails hhh14130_test_fails }} fails.

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

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/14c72b87/attachment.html 


More information about the hibernate-issues mailing list