-->
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.  [ 3 posts ] 
Author Message
 Post subject: HQL using 'in' named parameter
PostPosted: Tue Jun 22, 2004 11:48 am 
Newbie

Joined: Tue Jun 22, 2004 11:35 am
Posts: 10
Hi
I'm trying to use the an 'in' statement where the values are passed in by the application.

my select is as follows

select ass.comp_id.name, ass.comp_id.description
from Assignments ass
where ass.busCode in :busCodes

where :busCodes is a Collection of String objects now i have tried the following to no avail

select ass.comp_id.name, ass.comp_id.description
from Assignments ass
where ass.busCode in elements(:busCodes)

and

select ass.comp_id.name, ass.comp_id.description
from Assignments ass
where ass.busCode in (elements(:busCodes))

in both instances i don't get any error msgs but i don't get any results either but if i take the query in the hibernate logs and replace the ? manually with the coma delimited list the query works
any ideas??


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 22, 2004 12:14 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
use "in (:something)" and query.setParameterList()


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 23, 2004 3:58 am 
Newbie

Joined: Tue Jun 22, 2004 11:35 am
Posts: 10
thanks, that did the trick. i had thought that using setParameter would pickup that the param was a Collection and handle it.

Thanks again


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

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.