Can you please explain the reason you need the nested dynamic tag?

Why not simply do this?...

<statement id="foo" resultMap="fooMap">
       select * from mytable
       <dynamic prepend="where">
              (
                       <isNotEmpty prepend="or" property="prop1">
                               field1 = prop1
                       </isNotEmpty>
                       <isNotEmpty prepend="or" property="prop2">
                               field2 = prop2
                       </isNotEmpty>
               )
               <isNotEmpty prepent="and" property="prop3">
                       field3 = prop3
               </isNotEmpty>
       </dynamic>
</statement>

Brandon


On Fri, Jun 13, 2008 at 8:39 AM, <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> Is it possible to nest dynamic statements in Ibatis?  Here is a simple
> example of what I want to do:
>
> <statement id="foo" resultMap="fooMap">
>        select * from mytable
>        <dynamic prepend="where">
>                <dynamic open="(" close=")">
>                        <isNotEmpty prepend="or" property="prop1">
>                                field1 = prop1
>                        </isNotEmpty>
>                        <isNotEmpty prepend="or" property="prop2">
>                                field2 = prop2
>                        </isNotEmpty>
>                </dynamic>
>                <isNotEmpty prepent="and" property="prop3">
>                        field3 = prop3
>                </isNotEmpty>
>        </dynamic>
> </statement>
>
> The XML validation against the DTD (*
> http://ibatis.apache.org/dtd/sql-map-2.dtd*<http://ibatis.apache.org/dtd/sql-map-2.dtd>)
> fails because of the nested dynamic element.  I know that I could make a
> collection of these conditions and iterate over them as a hack to
> accomplishing this, but I am wondering if the example above is supported or
> planned to be supported in some version of Ibatis.
>
> Thank you,
> David

Reply via email to