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. |
|