ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Problem with sql statement, help wanted.
Date Mon, 23 Jun 2008 22:41:36 GMT
You won't be able to use ibator's Example class here - this is a
specialized class and will only work with the ibator generated
*ByExample methods.

So you'll need to write your own parameter class, or use a HashMap.

This is pretty basic iBATIS stuff - I suggest you take a look at an
iBATIS tutorial somewhere.

Jeff Butler


On Mon, Jun 23, 2008 at 11:44 AM, Sophia <jdev02@telenet.be> wrote:
> Would anyone help me.
>
> When I use this:
>
> List tmpList = accountList2Dao.selectByAccountList2(account2Example);
>
> And this in my sqlmap:
>
> <select id="selectByAccountList2" parameterClass="model.AccountExample" resultMap="abatorgenerated_AccountResult">
>    Select number, etc……… from ${schema1}.account where number in
>    (select number from ${schema1}.account where substr(number,5,4) between '2002' and
'2006' and office = 'L2')
>  </select>
>
> I get al the data that I want, and it works fine.
> The problem is that the sql is dynamic, I mean that the data 2002 – 2006 and L2 is
inputted by the user thru a webpage.
> When I rewrite in the past my application to Ibatis I have no problem with any select,
insert, delete statement (Abator)
> But when I now want to write my own specific sql, it will not work.
>
> Now, my problem is when I use this :
>
> account2Example.createCriteria().andNumberDateBetween(startdate, enddate).andOfficeEqualTo(office);
>
> and this as sql
>
> <select id="selectByAccountList2" parameterClass="model.AccountExample" resultMap="abatorgenerated_AccountResult">
>    Select number, etc……… from ${schema1}.account where number in
>    (select number from ${schema1}.account )
>  </select>
>
> I get errors, can anyone tell me a easy way to write your own sql statements in Ibatis?
> Help and suggestions are appreciated.
>
>
> Regards,
> Sophia.
>
>
>
>

Mime
View raw message