db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Bowen <s...@yahoo.com>
Subject RE: Somewhat complex query with Criteria
Date Tue, 01 Feb 2005 08:33:53 GMT
I think that worked! Brilliant! You just saved me a
load of work!

Thanks again!
syg

--- Michael.Kashambuzi@bmwna.com wrote:

> Robert:
> 
> You can try this.
> 
> Criteria c = new Criteria();
> 
> Criteria.Criterion A =
> criteria.getNewCriterion(NotificationPeer.CODE, 0,
> Criteria.EQUAL);
> 
> Criteria.Criterion B =
> criteria.getNewCriterion(NotificationPeer.CODE, 0,
> Criteria.NOT_EQUAL);
> 
> Criteria.Criterion C =
> criteria.getNewCriterion(NotificationPeer.TYPE, "C",
> Criteria.EQUAL);
> 
> criteria.add(A.or(B.and(C)));
> 
> Hope this helps.
> 
> Michael
> 
> -----Original Message-----
> From: Robert Bowen [mailto:syg6@yahoo.com]
> Sent: Monday, January 31, 2005 4:36 AM
> To: torque-user@db.apache.org
> Subject: Somewhat complex query with Criteria
> 
> 
> I am trying to execute the following query:
> 
> SELECT * FROM notification WHERE
> ( (code=0) OR
> (code <>0) AND (type='C') )
> 
> I have tried (I think) every possible combination of
> Criteria.add, Criteria.and and Criteria.or and I
> can't
> get it to spit out the correct SQL code. It keeps
> putting:
> 
> WHERE type='C'
> 
> at the beginning of the query and then lumping
> together the "code" part:
> 
> ( (code=0) AND (code<>0) )
> 
> Anyone have a clue how I can do this? I would prefer
> not to use executeQuery() instead ...
> 
> Many thanks!
> syg
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> Take Yahoo! Mail with you! Get it on your mobile
> phone. 
> http://mobile.yahoo.com/maildemo 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail:
> torque-user-help@db.apache.org
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail:
> torque-user-help@db.apache.org
> 
> 



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message