db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Emminger <e...@ericemminger.com>
Subject Re: using LIKE clause
Date Wed, 12 Mar 2003 16:07:41 GMT
Try this.

crit.add(YourPeer.YOURCOLUMN, (Object) ("LOWER(" + YourPeer.YOURCOLUMN + 
") LIKE '%" + keywords + "%'"), Criteria.CUSTOM);

It works with my setup. :)
----- setup -----
Torque 3.0
Turbine 2.2
TDK 2.2_01
PostgreSQL 7.3.2
Ant 1.5.1
Maven 1.0-beta-8
Java 1.4.1_01
Linux

Eric

Dan Allen wrote:
> At least in my version of javac, JDK 1.4.1, the only way to make the
> LIKE Criteria work without throwing that ambiguous clause message is
> to create the object outside of the call to add()
> 
> Object keywordSearch = (Object) "%" + keyword + "%";
> crit.add(KEYWORD, keywordSearch, Criteria.LIKE);
> 
> no matter what else I try, no matter how many () I use around the
> cast, I can't get it to work with the keywordSearch string inline
> with the function call.
> 
> Dan
> 


Mime
View raw message