|
We are facing the same issue.
There is someting in JPA 2.0 that could be used (https://docs.jboss.org/hibernate/jpa/2.1/api/javax/persistence/Query.html#setParameter%28javax.persistence.Parameter,%20T%29) :
setParameter(Parameter<T> param, T value) Bind the value of a Parameter object.
The definition of Parameter<T> (https://docs.jboss.org/hibernate/jpa/2.1/api/javax/persistence/Parameter.html) is
java.lang.String getName() Return the parameter name, or null if the parameter is not a named parameter or no name has been assigned.
java.lang.Class<T> getParameterType() Return the Java type of the parameter.
java.lang.Integer getPosition() Return the parameter position, or null if the parameter is not a positional parameter.
Unfortunettly Hibernate 4.3 use getPosition() and getName() but getClass() is never used.
The best way to declare class type should be using setParameter.
|