build the lastName argument i.e. {0} with a % around it - for eg: %smith%. Should worok fine then.

----- Original Message -----
From: Carles Pi-Sunyer
Sent: Thursday, May 03, 2001 3:08 AM
To: [EMAIL PROTECTED]
Subject: [JBoss-user] LIKE queries in cmp

Is it possible to to create LIKE queries in a jboss
cmp bean?

I would like to do something that allows a query that
is the same as:

select * from users where last_name like %smith%

I've looked through the archives and found a couple of
examples.

One has the jaws.xml configured:
            <finder>
                <name>findByLikeLastname</name>
                <query>lastName like {0}</query>
                <order>lastName DESC</order>
            </finder>

when I do this I only get back the exact match.

A second example has:
            <finder>
                <name>findByLikeLastname</name>
                <query>lastName like '%{0}%'</query>
                <order>lastName DESC</order>
            </finder>
this produces a FinderException.

I've also tried: %{0}% and '{0}' which both also
produce FinderExceptions.

Has anyone had any luck creating a query that uses
LIKE?

Any help is appreciated.

Thanks,
Carles

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user



Get your FREE download of MSN Explorer at http://explorer.msn.com

Reply via email to