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.  [ 1 post ] 
Author Message
 Post subject: Use or with criteria query
PostPosted: Fri Apr 06, 2007 8:18 am 
Newbie

Joined: Wed Jan 31, 2007 8:44 am
Posts: 9
I have a little question, I've a piece of code that build programmatically a criteria query, my problem is this, I use ICriteria.CreateCriteria to make restriction on associated class, but this compose with and clause.

Example :
NHibernate.ICriteria criteria = sess.CreateCriteria(typeof(Alert));
NHibernate.ICriteria custcriteria = criteria.CreateCriteria("Customers");
custcriteria.Add(NHibernate.Expression.Expression.Eq("Id", 39));
criteria.Add(NHibernate.Expression.Expression.Eq("Status", 3));

I need to find all alert related to customer id 39 OR status = 3, but with code above the two condition are combined with and. I cannot use disjunction because I have two distinct criteria, is there a solution without using alias?

Alk.


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

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.