Use JDBC bind variables for handling JPA Criteria query numeric literals

Description

A predicate with a String literal criteriaBuilder.equal(from.get("name"), "horse"); creates a bind parameter: name=aram. Fine!

A predicate with a numeric literal criteriaBuilder.equal(from.get("age"), Integer.valueOf(42)); does not create a bind parameter: age=42. Not fine!

The concern here is that the fact that literals are used in the JDBC query rather than bind variables (parameters) a PreparedStatement cannot be effectively cached.

I think caused this issue.

Test Case

Animal.java

CriteriaParameterTest.java

Environment

None

Assignee

Andrea Boriero

Reporter

Kai PrĂ¼nte

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Affects versions

Priority

Major
Configure