try with:
criteria.add("TURBINE_USER.LAST_NAME", (Object)("TURBINE_USER.LAST_NAME LIKE
'%" + searchString+ "%'"), (String)Criteria.CUSTOM);
this is the way I used to do LIKE comparison in my apps, and it works pretty
well.
hope it's usefull, Andrea
----- Original Message -----
From: "Steve Davis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 26, 2001 5:44 AM
Subject: How do I get a 'LIKE' comparison in Criteria
> I am trying to do a LIKE comparison in the WHERE clause of my search.
>
> I create my criteria like so:
>
> String searchString = "foo";
> Criteria crit = new Criteria();
> crit.add("TURBINE_USER.LAST_NAME", (Object) searchString,
> Criteria.LIKE );
>
> When I do a toString() on the criteria it gives me
>
> SELECT FROM TURBINE_USER WHERE (TURBINE_USER.LAST_NAME = 'foo')
>
> I dug through the code and it looks like TurbineUserPeer doSelect method
> feeds the BasePeer doSelect which calls createQueryString to build the
> query from the criteria. I do not see anywhere in createQueryString
> where it would include any comparisons.
>
> Am I missing something. Is this the correct way to do a "LIKE"
> comparison?
> I think I am doing same thing that the criteria doc example shows. I am
> using code from the CVS HEAD of about 3 weeks ago. It builds the
> turbine-2.2-dev.jar. I would appreciate any pointers someone could give
> me.
>
> -- Steve Davis
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]