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.



Reply via email to