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.  [ 5 posts ] 
Author Message
 Post subject: Creating "or" expressions w/ Criteria API?
PostPosted: Tue Oct 26, 2004 5:01 pm 
Newbie

Joined: Wed Mar 03, 2004 11:27 am
Posts: 3
Is there any way to "or" multiple values of the same property together using the Criteria API?

I want to basically do something like "SELECT users WHERE lastname = smith AND (department=HR OR department=Accounting)

Thanks in Advance.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 26, 2004 6:42 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Of course. This is clearly explained in the Criteria API chapter of the reference doc. Please read it.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 26, 2004 7:04 pm 
Newbie

Joined: Wed Mar 03, 2004 11:27 am
Posts: 3
I had read Chapter 12 in the reference doc, but in my use of add(), it appears that it is "and"-ing together the criteria. Am I being really stupid and missing something, or am I looking in the wrong place?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 26, 2004 7:18 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Look at Expression.disjunction()


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 27, 2004 9:36 am 
Newbie

Joined: Wed Mar 03, 2004 11:27 am
Posts: 3
That did the trick! Thanks, Michael.


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