db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jarnot Voytek Contr AU HQ/SC <Voytek.Jar...@MAXWELL.AF.MIL>
Subject RE: Help on building an sql criteria
Date Mon, 24 Nov 2003 16:17:46 GMT
How about this:

...
criteria.add(YourPeer.ARTICLENAME, "%searchString%", Criteria.LIKE);
Criteria.Criterion criterion = criteria.getCriterion(YourPeer.ARTICLENAME);
criterion.or(criteria.getNewCriterion(
                             criterion.getTable(),
                             criterion.getColumn(),
                             "%searchString%",
                             Criteria.LIKE ));
...

Try that.

By the way, I essentially cut and paste the code above from the torque
website - the criteria howto should be your first resource:
http://db.apache.org/torque/criteria-howto.html

--
Voytek Jarnot
Quantum materiae materietur marmota monax si marmota monax materiam possit
materiari?


> -----Original Message-----
> From: Founaboui Haman [mailto:fhaman@kommunity.net]
> Sent: Monday, November 24, 2003 10:10 AM
> To: torque-user@db.apache.org
> Subject: Help on building an sql criteria
> 
> 
> Hi there,
> 
> I am looking for a way to build the following criteria in torque.
> The sql: 
> 
> SELECT * FROM articles WHERE any condition AND (articlename 
> LIKE '%seachString%' OR articleNumber LIKE '%searchString%');
> 
> My problem resides in the criteria between the parenthesis. 
> Any help with code shnippet could be appreciated.
> Thank for your help
> 
> haman
> 

---------------------------------------------------------------------
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