db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remke Rutgers <Remke.Rutg...@brightalley.nl>
Subject RE: Question about LIKE Criteria
Date Mon, 20 Jan 2003 14:30:39 GMT
Hi,

I think Criteria.LIKE only results in a LIKE operator if your comparison
string contains a wildcard (I think both the SQL % and ? wildcards and the
'normal' wildcards * and ? result in the desired behavior).

Feel free to correct me if I am mistaken.

Remke

-----Oorspronkelijk bericht-----
Van: Derick Fernando [mailto:derick@xenocex.com]
Verzonden: maandag 20 januari 2003 10:07
Aan: Turbine Torque Users List
Onderwerp: Question about LIKE Criteria


Hello,

In my Action class I do this:

Criteria ct = new Criteria();
Criteria.Criterion ctoa = ct.getNewCriterion(ProductsPeer.DESCRIPTION,
(Object) term, Criteria.LIKE);
Criteria.Criterion ctob = ct.getNewCriterion(ProductsPeer.NAME, (Object)
term, Criteria.LIKE);
ct.setIgnoreCase(true);
ct.add( ctoa.or( ctob ) );
ct.setDistinct();
List pro = ProductsPeer.doSelect(ct);

However this creates an equal ("=") query instead of a LIKE query as seen
below. Am I doing something wrong?
I'd like to do this without adding a method to the base classes.

12398 [HttpProcessor[8080][4]] DEBUG util.BasePeer  - SELECT DISTINCT
PRODUCTS.I
D, PRODUCTS.NAME, PRODUCTS.CATID, PRODUCTS.SUBCATID, PRODUCTS.DESCRIPTION,
PRODU
CTS.PRICE, PRODUCTS.MADEIN, PRODUCTS.INSTOCK, PRODUCTS.DEFAULTPRODUCT,
PRODUCTS.
ACTIVE, PRODUCTS.SHIPPING, PRODUCTS.SHIPPINGADD FROM PRODUCTS WHERE
(PRODUCTS.DE
SCRIPTION = 'shirt' OR PRODUCTS.NAME = 'shirt')

Thanks,
Derick


--
To unsubscribe, e-mail:
<mailto:turbine-torque-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:turbine-torque-user-help@jakarta.apache.org>

Mime
View raw message