Your property names don't match what you have between ##.  How about:

             <isNotNull prepend="AND" property="eced">
                  eced=#eced#
             </isNotNull>
             <isNotNull prepend="AND" property="demc">
                demc=#demc#
             </isNotNull>



On Feb 1 2008, FranT wrote:

Hi there, i'm new ti iBatis and need help for my first dynamic statement.
Here it is:


<resultMap id="getDynam" class="my.ft.kcaldos">
       <result property="dndl" column="DNDL"/>
       <result property="ncal" column="NCAL"/>
       <result property="datcom" column="DATCOM"/>
   </resultMap>
<select id="dynamis" parameterClass="java.util.Map"
                        resultMap="getDynam">
SELECT dndl, ncal, datcom from kcaldos <dynamic prepend="WHERE">
             <isNotNull prepend="AND" property="eced">
                  eced=#ec#
             </isNotNull>
             <isNotNull prepend="AND" property="demc">
                demc=#dem#
             </isNotNull>
         </dynamic>
                 where datcom > to_date('01/01/2007','DD/MM/YYYY')
                 order by dndl
  </select>

When running it, i stil get;
'SELECT dndl, ncal, datcom from kcaldos where datcom >
to_date('01/01/2007','DD/MM/YYYY') order by dndl'
even when the two properties (eced and demc) are not null.
May be i'm missing something somewhere ? Thanks in advance.



Reply via email to