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 bhaarat Sharma <bh...@gmail.com> on 2008/01/08 17:09:32 UTC

reusing resultMaps from different sqlMaps

Hi,

does iBatis provide a way to reuse resultMaps between different sqlMaps?

for example we have sqlMap1 with namespace A and another sqlMap with
namespace B.

Further, assume sqlMap A has a resultMap in it named testA.  Can
sqlMap B use sqlMap A resultMap??

in sqlMap B I tried something like this
<procedure id=\"Report\" parameterMap=\"ReportCall\" resultMap=\"A.testA\">
        {call some_proc(?)}
</procedure>

but that doesnt seem to work and gives an error message that there is
no resultMap named A.testA in sqlMap \'B\'.

I\' appreciate any help in the matter

Re: reusing resultMaps from different sqlMaps

Posted by Jeff Butler <je...@gmail.com>.
This works - but there is a known issue.  You must specify the maps in
proper order in your SqlMapConfig file so that that the referenced maps are
loaded before the referencing maps.

In you example, make sure that A is specified before B.  Also, make sure
that statement namespaces are enabled.

Jeff Butler



On Jan 8, 2008 10:09 AM, bhaarat Sharma <bh...@gmail.com> wrote:

> Hi,
>
> does iBatis provide a way to reuse resultMaps between different sqlMaps?
>
> for example we have sqlMap1 with namespace A and another sqlMap with
> namespace B.
>
> Further, assume sqlMap A has a resultMap in it named testA.  Can
> sqlMap B use sqlMap A resultMap??
>
> in sqlMap B I tried something like this
> <procedure id=\"Report\" parameterMap=\"ReportCall\" resultMap=\"A.testA\
> ">
>        {call some_proc(?)}
> </procedure>
>
> but that doesnt seem to work and gives an error message that there is
> no resultMap named A.testA in sqlMap \'B\'.
>
> I\' appreciate any help in the matter
>