-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Unaware how to convert value ...
PostPosted: Thu Jun 23, 2011 2:28 am 
Newbie

Joined: Sat Aug 30, 2008 5:15 am
Posts: 3
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.