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 Josh Joy <jo...@gmail.com> on 2008/05/21 21:34:08 UTC

select "extends" ?

Hi,

I saw in the ibatis docs for dotnet there is a way to use extends with
select elements...
http://ibatis.apache.org/docs/dotnet/datamapper/ch03s03.html

Is there something similar for Java? I am looking to append the following
xml to lots of my sql select statements...
    <dynamic prepend="ORDER BY ">
       <isNotEmpty property="SortField">
           ORDER BY $SortField$ $SortType$
       </isNotEmpty>
   </dynamic>


Thanks,
Josh

Re: select "extends" ?

Posted by Gilles Bayon <ib...@gmail.com>.
The .NET version can extend statement, resultMap, parameterMap.

-- 
Cheers,
Gilles

Re: select "extends" ?

Posted by Clinton Begin <cl...@gmail.com>.
Right.  The Java version can extend maps, just not the statements.

Clinton

On Wed, May 21, 2008 at 2:24 PM, Michael Schall <mi...@gmail.com>
wrote:

> For the record, the .Net version has the same sql/include concept.  It also
> has the extends attribute.  I have not used "extend" to extend statements,
> but is is very nice to extend parameter and result maps.
>
>
> On Wed, May 21, 2008 at 2:49 PM, Josh Joy <jo...@gmail.com> wrote:
>
>> Cool...even better...
>>
>>
>> On Wed, May 21, 2008 at 2:43 PM, Clinton Begin <cl...@gmail.com>
>> wrote:
>>
>>> No, we took a different approach.  You can declare a <sql
>>> id="blah">block</sql> and then use it with <include id="blah"/> in your
>>> statement.  I believe the way iBATIS for Java does it is more flexible and
>>> predictable.  Direction becomes a problem with "extends".
>>>
>>> Clinton
>>>
>>>
>>> On Wed, May 21, 2008 at 1:34 PM, Josh Joy <jo...@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I saw in the ibatis docs for dotnet there is a way to use extends with
>>>> select elements...
>>>> http://ibatis.apache.org/docs/dotnet/datamapper/ch03s03.html
>>>>
>>>> Is there something similar for Java? I am looking to append the
>>>> following xml to lots of my sql select statements...
>>>>     <dynamic prepend="ORDER BY ">
>>>>        <isNotEmpty property="SortField">
>>>>            ORDER BY $SortField$ $SortType$
>>>>        </isNotEmpty>
>>>>    </dynamic>
>>>>
>>>>
>>>> Thanks,
>>>> Josh
>>>>
>>>
>>>
>>
>

Re: select "extends" ?

Posted by Michael Schall <mi...@gmail.com>.
For the record, the .Net version has the same sql/include concept.  It also
has the extends attribute.  I have not used "extend" to extend statements,
but is is very nice to extend parameter and result maps.

On Wed, May 21, 2008 at 2:49 PM, Josh Joy <jo...@gmail.com> wrote:

> Cool...even better...
>
>
> On Wed, May 21, 2008 at 2:43 PM, Clinton Begin <cl...@gmail.com>
> wrote:
>
>> No, we took a different approach.  You can declare a <sql
>> id="blah">block</sql> and then use it with <include id="blah"/> in your
>> statement.  I believe the way iBATIS for Java does it is more flexible and
>> predictable.  Direction becomes a problem with "extends".
>>
>> Clinton
>>
>>
>> On Wed, May 21, 2008 at 1:34 PM, Josh Joy <jo...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I saw in the ibatis docs for dotnet there is a way to use extends with
>>> select elements...
>>> http://ibatis.apache.org/docs/dotnet/datamapper/ch03s03.html
>>>
>>> Is there something similar for Java? I am looking to append the following
>>> xml to lots of my sql select statements...
>>>     <dynamic prepend="ORDER BY ">
>>>        <isNotEmpty property="SortField">
>>>            ORDER BY $SortField$ $SortType$
>>>        </isNotEmpty>
>>>    </dynamic>
>>>
>>>
>>> Thanks,
>>> Josh
>>>
>>
>>
>

Re: select "extends" ?

Posted by Josh Joy <jo...@gmail.com>.
Cool...even better...

On Wed, May 21, 2008 at 2:43 PM, Clinton Begin <cl...@gmail.com>
wrote:

> No, we took a different approach.  You can declare a <sql
> id="blah">block</sql> and then use it with <include id="blah"/> in your
> statement.  I believe the way iBATIS for Java does it is more flexible and
> predictable.  Direction becomes a problem with "extends".
>
> Clinton
>
>
> On Wed, May 21, 2008 at 1:34 PM, Josh Joy <jo...@gmail.com> wrote:
>
>> Hi,
>>
>> I saw in the ibatis docs for dotnet there is a way to use extends with
>> select elements...
>> http://ibatis.apache.org/docs/dotnet/datamapper/ch03s03.html
>>
>> Is there something similar for Java? I am looking to append the following
>> xml to lots of my sql select statements...
>>     <dynamic prepend="ORDER BY ">
>>        <isNotEmpty property="SortField">
>>            ORDER BY $SortField$ $SortType$
>>        </isNotEmpty>
>>    </dynamic>
>>
>>
>> Thanks,
>> Josh
>>
>
>

Re: select "extends" ?

Posted by Clinton Begin <cl...@gmail.com>.
No, we took a different approach.  You can declare a <sql
id="blah">block</sql> and then use it with <include id="blah"/> in your
statement.  I believe the way iBATIS for Java does it is more flexible and
predictable.  Direction becomes a problem with "extends".

Clinton

On Wed, May 21, 2008 at 1:34 PM, Josh Joy <jo...@gmail.com> wrote:

> Hi,
>
> I saw in the ibatis docs for dotnet there is a way to use extends with
> select elements...
> http://ibatis.apache.org/docs/dotnet/datamapper/ch03s03.html
>
> Is there something similar for Java? I am looking to append the following
> xml to lots of my sql select statements...
>     <dynamic prepend="ORDER BY ">
>        <isNotEmpty property="SortField">
>            ORDER BY $SortField$ $SortType$
>        </isNotEmpty>
>    </dynamic>
>
>
> Thanks,
> Josh
>