I think that worked! Brilliant! You just saved me a load of work! Thanks again! syg
--- [EMAIL PROTECTED] 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:[EMAIL PROTECTED] > Sent: Monday, January 31, 2005 4:36 AM > To: [email protected] > 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: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __________________________________ Do you Yahoo!? Yahoo! Mail - now with 250MB free storage. Learn more. http://info.mail.yahoo.com/mail_250 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
