I gave up trying to put the '%' in the XML file. Instead, I just add them to
the parameter value BEFORE calling into Ibatis.
I'm using the following in my XML file:
<mapped-statement name="getUsersByLoginOrNameLike"
inline-parameters="true" result-map="user-result">
select
ID,
LOGIN,
PWD,
NAME,
EMAIL,
PHONE,
CREATED,
CRUSERID,
UPDATED,
UPUSERID,
ACTIVE
from ALUSERS
where
LOGIN like #value:VARCHAR#
or NAME like #value:VARCHAR#
</mapped-statement>
Then, the Java code that calls it is:
public List findUsersByLoginOrName(String name) throws SQLException {
return sqlMap.executeQueryForList(
"getUsersByLoginOrNameLike", "%" + name + "%");
}
Seems to work for me. Good luck!
-Matthew S. Ring
-----Original Message-----
From: Andy Engle [mailto:[EMAIL PROTECTED]
Sent: Friday, March 26, 2004 3:41 PM
To: Struts Users Mailing List
Subject: Re: [OT] "SELECT ... LIKE" with iBatis
Ronald Rotteveel <[EMAIL PROTECTED]> wrote:
> Hi Andy,
>
> we have a same kind of statement in our xml file and it looks like
> this:
>
> <mapped-statement name="statementName" result-map="result">
> SELECT * FROM tbl_name WHERE column_name LIKE '%';
> </mapped-statement>
Right, but I was running into trouble with where to put my #value#.
Did you have anything like that in there? I tried stuff like
'%#value#%', %#value#%, and whatever else but it didn't seem to want to
do anything but sit there and look at me.
Andy
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]