-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate Query: using not in
PostPosted: Sun Dec 21, 2003 9:55 am 
Newbie

Joined: Mon Dec 08, 2003 6:33 am
Posts: 5
How to do a query with
Code:
not in
given list

List stateList;
e.g select count(*) from Person p where p.state not in ?, stateList


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 21, 2003 10:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You should be able to do this:
session.createQuery("select count(*) from Person p where p.state not in (:stateList)").setParameter("stateList", stateList).uniqueResult();


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 22, 2003 2:49 am 
Newbie

Joined: Mon Dec 08, 2003 6:33 am
Posts: 5
Thanks, gloeglm.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 22, 2003 6:07 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This should be .setParameterList() actually


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.