ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Butler <jeffgbut...@gmail.com>
Subject Re: iBatis 3.x common sql fragments?
Date Mon, 08 Feb 2010 15:53:40 GMT
Yes - everything's in xml for me.

Jeff Butler


On 2/8/10, Alex Sherwin <alex.sherwin@acadiasoft.com> wrote:
> Are you registering your mappers all in the configuration XML?  I tried
> to programatically register my common SqlMap file first, and I'm still
> having the same problem.  I'm wondering if that is my problem
>
> Jeff Butler wrote:
>> I'm doing this (across different xml files). I believe ibatis is still
>> load order dependant - so your fragments file needs to be loaded in
>> the configuration before the file that uses the fragments.
>>
>> Jeff Butler
>>
>>
>> On 2/8/10, Alex Sherwin <alex.sherwin@acadiasoft.com> wrote:
>>
>>> Martin Ellis wrote:
>>>
>>>> On 8 February 2010 14:40, Alex Sherwin <alex.sherwin@acadiasoft.com>
>>>> wrote:
>>>>
>>>>
>>>>> I'm trying to create a "common" Sql Map XML file that will contain some
>>>>> common fragments.  In iBatis 2.x this was easy enough, the fragments
>>>>> were
>>>>> referenced by other Sql Map files by using <include
>>>>> refid="fully.qualified.ns.Statement"/>
>>>>>
>>>>> I assumed the same would be true for iBatis 3.x as well, but doesn't
>>>>> seem
>>>>> to
>>>>> be working for me. Right now, the only mapper I have in my config xml
>>>>> in
>>>>> the
>>>>> <mappers> element is my common xml fragment, while the rest of
my
>>>>> mappers
>>>>> are registered with iBatis programatically.  I gave my common Sql Map
a
>>>>> namespace of "common", and tried to reference a statement from another
>>>>> SqlMap with <sql refid="common.params"/>, I see this exception:
>>>>>
>>>>>
>>>> I'm using something like this, which works fine:
>>>>
>>>>   <select id="series" parameterType="map" resultMap="...">
>>>>     SELECT ...
>>>>     <where>
>>>>       <include refid="seriesFilter"/>
>>>>     </where>
>>>>   </select>
>>>>
>>>>   <sql id="seriesFilter">
>>>>     ...
>>>>
>>>> N.B. The tag I'm using is 'include', and I didn't need to qualify the
>>>> sql
>>>> id.
>>>>
>>>> Martin
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>>
>>>>
>>>>
>>>>
>>>>
>>> That does work, within the same XML document; I'm trying to reference a
>>> <sql> fragment that is defined in a different XML document
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

-- 
Sent from my mobile device

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message