You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by st...@gmail.com on 2006/01/25 14:14:36 UTC

Problem about dynamic query

Dear all,

I use following for dynamic query in two connection enviroment, JNDI
connection and SIMPLE connection.
But in SIMPLE connection is working, and JNDI always return 0 records even
database has data.

But in JNDI enviroment, if I only set one condition, it's working, why?

PLease tell me what's wrong with it?

Following is the sql map XML file, thanks for your warm-hearted help:

 <select id="getPersonInfo" parameterClass="com.istc.cto.po.PersoninfoPO"
resultClass="com.istc.cto.po.PersoninfoPO">
    <![CDATA[
  select * from cto.personinfovo
     ]]>
      <dynamic prepend="WHERE">
        <isNotNull prepend="AND" property="id">
              <![CDATA[ (id=#id#) ]]>
        </isNotNull>
        <isNotNull prepend="AND" property="name">
               <![CDATA[  (name=#name#) ]]>
        </isNotNull>
        <isNotNull prepend="AND" property="area">
               <![CDATA[  (area=#area#) ]]>
        </isNotNull>
       </dynamic>
  </select>


Thanks and Best Regards
Steven