Criteria c = new Criteria();
Criteria.Criterion fromCat = c.getNewCriterion(
IxConnectionPeer.FROM_CATEGORY, category, Criteria.EQUAL);
Criteria.Criterion toCat = c.getNewCriterion(
IxConnectionPeer.TO_CATEGORY, category, Criteria.EQUAL);
c.add(fromCat.or(toCat));
Aaron Loucks wrote:
According to the API Docs :
or
public Criteria <http://db.apache.org/torque/apidocs/org/apache/torque/util/Criteria.html> or(java.lang.String column, java.lang.Object value, SqlEnum <http://db.apache.org/torque/apidocs/org/apache/torque/util/SqlEnum.html> comparison)
This method adds a new criterion to the list of criterias. If a criterion for the requested column already exists, it is "OR"ed to the existing criterion. If is used as follow:
Is there any way for force the Criteria to be OR'ed? For example I'm trying to do something like the following:
SELECT * FROM table WHERE first_name LIKE '%queryString%' OR last_name LIKE '%queryString%';
When I create the criteria by doing something like the following, it always creates the statement with AND's rather than an OR. According to the documentation this is correct, but this isn't the output I'm looking for. Is there something in the API that I over looked? Or is this not possible?
Criteria c = new Criteria();
String queryString = "joe";
c.add(TablePeer.FIRST_NAME, (Object)("%" + queryString + "%"), Criteria.LIKE);
c.or(TablePeer.LAST_NAME, (Object)("%" + queryString + "%"), Criteria.LIKE);
- Aaron
-- Bill Leng Sr. Software Engineer Metatomix, Inc. Tel: (901)261-8911 Fax: (901)261-8901
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]