Have you tried Criteria.or(...) method? Howard Lin
> -----Original Message----- > From: Daniel Seltzer [mailto:[EMAIL PROTECTED]] > Sent: Monday, October 07, 2002 3:09 PM > To: [EMAIL PROTECTED] > Subject: How to construct a WHERE clause using OR instead of > AND between > Criteria? > > > I'm running 3.0-b4 and have a question about how to control > the construction > of the WHERE clause from Criteria. I've reviewed the docs, > the archives and > the source but suspect I'm missing something obvious... > > I'm trying to construct a simple query that looks like this: > > select * from table1 where col1 = 'foo' or col2 = 'foo' > > But all expressions in a WHERE clause appear to be joined with AND by > default, regardless of how the Criteria are added. In the source for > org.apache.torque.util.Query, line 253, it looks like AND is > being passed to > the StringStack's toString() method as the delimiter for output: > > if ( !whereCriteria.empty() ) > { > stmt.append(WHERE) > .append(whereCriteria.toString( AND )); > } > > Is there some other way to indicate that multiple criteria in > a Query should > be OR'd instead of AND'd? > > Thanks, > Daniel > > ________________________________________ > > Daniel Seltzer > [EMAIL PROTECTED] > www.h2co3.com > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
