ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Karl Schwaerzler <Thomas.Schwaerz...@uibk.ac.at>
Subject abator: dynamic where clause
Date Mon, 14 Aug 2006 18:15:32 GMT


hello again,

i'd like to do something like the following,
a 'dynamic where clause':

public List<OdmCustomer> search( long groupId, String criterion,
List<String> columns )
{
   String where = "";

   while (existsNext)
   {
      column = (String) i.next();
      where += column + " LIKE '%" + criterion + "%'";
      if (existsNext = i.hasNext())
         where += " OR ";

   }

   //...



just using ibatis, it looks like this;

<select id="search" parameterClass="string" 
resultMap="abatorgenerated_OdmCustomerResult">
     select ID,
       TITLE,
       FIRST_NAME,
       LAST_NAME,
       STREET,
       ZIP_CODE,
       CITY,
       COUNTRY,
       PHONE_MOBILE,
       PHONE,
       FAX,
       EMAIL,
       GROUP_ID
     from c108272dev.ODM_CUSTOMER
     WHERE $value$
</select>

do i have to write my own sqlmap select entry like above for this or is 
there a way 
to do somthing like this with abator (e.g. with example?) ?


thanks
t.

Mime
View raw message