Many diffierent solutions are presented here, personally - I use the "CONCAT" string function which is present in most SQL databases, that way you don't need to worry about how strings are concatenated in short hand.
YMMV Brice On Tue, 18 Jan 2005 12:22:55 -0500, Nilesh Bhattad <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > Is there a way to change a property value before it is plugged in to the > select statement? > > > > <select id="search" parameterClass="java.util.HashMap" > resultClass="java.util.HashMap"> > > select ConsultantId, BlackListed, FirstName, LastName, > HomeTelephone, EmailAddress, InterviewGrade, TotalYrsOfExp from Consultant > > <dynamic prepend=" where "> > > <isNotEmpty property="FirstName" prepend=" and ">FirstName > like #FirstName#</isNotEmpty> > > <isNotEmpty property="LastName" prepend=" and ">LastName > like #LastName#</isNotEmpty> > > <isNotEmpty property="ActiveInactive" prepend=" and > ">ActiveInactive like #ActiveInactive#</isNotEmpty> > > </dynamic> > > order by FirstName, LastName > > </select> > > > > For example, in the above case, when FirstName is present, is there a way to > attach '%' at the end of the FirstName's value and then perform the select > operation? > > > > For some reason, in the calling program, I won't be able to attach '%' at > the end of the search fields. Well, somehow I could achieve that before the > iBatis call is made, but I'm kindof hesitant to go with that approach. So I > was wondering is there any way to handle it in iBatis layer. Any help is > highly appreciated. > > > > Thanks > > Nilesh