Hello,
I'm trying to build a parameterized typed query. i've been trying to follow the (too numerous) tutorials online and i cannot figure out what i am doing wrong. I'm getting IllegalArgumentException: Unaware how to convert value [org.hibernate.ejb.criteria.expression.ParameterExpressionImpl@48d86fa8 : org.hibernate.ejb.criteria.expression.ParameterExpressionImpl] to requested type [java.lang.Long] when trying to do this:
Parameter<Long> keyParameter = cb.parameter(Long.class); Predicate idPredicate = cb.equal(query.from(MyEntity.class) .<Long> get(MyEntity_.id), idParameter); //exception thrown Here
Hibernate is trying to handle my Parameter as a value as it uses the ValueHandlerFactory to retrieve a LongValueHandler. I've been looking into its source code and it is obviously unable to manage with Parameters.
Have i made a mistake here?
|