-->
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 in expression
PostPosted: Thu May 14, 2009 12:16 pm 
Newbie

Joined: Thu May 14, 2009 11:36 am
Posts: 2
I am trying to use the in expression like in:
Code:
from DomesticCat cat where cat.name in ( 'Foo', 'Bar', 'Baz' )

But in my case I would need to pass 'Foo', 'Bar', 'Baz' as a parameter, so I have something like this:
Code:
from DomesticCat cat where cat.name in ( :names )

But I don't know how to set that parameter to the query. I have tried as follows:
Code:
myQuery.setParameter("names", new String[] {"Foo", "Bar", "Baz"})

But it didn't work. Any other idea?

Thanks a lot in advance for any help.


Top
 Profile  
 
 Post subject: Re: HQL in expression
PostPosted: Fri May 15, 2009 3:49 am 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
Here you'll find an example for that.

_________________
-----------------
Need advanced help? http://www.viada.eu


Top
 Profile  
 
 Post subject: Re: HQL in expression
PostPosted: Fri May 22, 2009 5:13 pm 
Newbie

Joined: Thu May 14, 2009 11:36 am
Posts: 2
Tank you. I don't know why I didn't see the method setParameterList(...)

Thanks a lot :)


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.