-->
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.  [ 2 posts ] 
Author Message
 Post subject: A query with an or in the criteria
PostPosted: Thu Nov 09, 2006 3:15 am 
Newbie

Joined: Thu Nov 09, 2006 3:08 am
Posts: 3
Hi there, does anyone know how to write the following sql equivalent with the org.hibernate.Criteria api?

select * from x where (name='john' and title='mr') or (position='executive' and opinion='conservative')

I've been running this as two separate queries and I'm finding it too inefficient. I'd like to run them as a single query, can anyone help.

Cheers, Sivan.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 09, 2006 7:50 pm 
Newbie

Joined: Thu Nov 09, 2006 3:08 am
Posts: 3
After reading the 'hibernate in action' manual I've found that using an Expression.disjuntion() will give me that I want.


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