db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Loucks <aar...@GardnerInc.com>
Subject Force OR statement?
Date Mon, 10 Jan 2005 21:37:05 GMT
According to the API Docs :


public Criteria
or(java.lang.String column,
                   java.lang.Object value,

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


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 + "%"),

c.or(TablePeer.LAST_NAME, (Object)("%" + queryString + "%"), Criteria.LIKE);



- Aaron


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message