Re: Importing a resultMap

18 views
Skip to first unread message

Dridi Boukelmoune

unread,
Nov 15, 2012, 1:34:35 PM11/15/12
to mybati...@googlegroups.com
Hi,

It is possible, but not straight forward, I think you need to declare
your reusable resultmap as a cache, and other mappers "import" it with
cache-ref.

I can't test but if I remember myself doing something like that...

Dridi

On Thu, Nov 15, 2012 at 6:59 PM, Kevin Adams <adak...@gmail.com> wrote:
> Is it possible to reuse a particular resultMap from one of the mapper xml
> files in another mapper file?
>
> After I've coded a particularly large map, there are times when I'd like to
> reuse it and not have to copy/paste.
>
> I hope I've not overlooked something very easy.
>
> Any help would be appreciated.
>
>



--
Dridi Boukelmoune
Développeur/Formateur

GSM : +33 (0)6 17 91 14 23

Jeff Butler

unread,
Nov 15, 2012, 1:36:00 PM11/15/12
to mybati...@googlegroups.com
It's very easy - just use the fully qualified name (namespace.id).  No need to import.

Guy Rouillier

unread,
Nov 15, 2012, 1:36:48 PM11/15/12
to mybati...@googlegroups.com
On 11/15/2012 12:59 PM, Kevin Adams wrote:
> Is it possible to reuse a particular resultMap from one of the mapper
> xml files in another mapper file?

Sure. To access a resource defined in a different mapper file, just
supply the fully qualified path to that resource. So where you might
refer to the target resultMap as "myResultMap" in the same mapper file
as your select, to refer to it in a different mapper file, use
"com.mycompany.myproject.myOtherMapperFile.myResultMap".

That's the theory, anyway :). I've used this for select statements, but
not for resultMap references. I'm assuming the same rules apply.

--
Guy Rouillier

Kevin Adams

unread,
Nov 15, 2012, 8:35:37 PM11/15/12
to mybati...@googlegroups.com
Thank you so much! This is fantastic.

I really appreciate the help.
Reply all
Reply to author
Forward
0 new messages