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 Stefan Podkowinski <sp...@gmail.com> on 2006/07/28 11:01:10 UTC

statements and result maps in different files?

Hello

Can anyone give advise how to seperate object mappings from statements
in ibatis? We would like to create a file containing a few complex
reporting queries with the intention to use it as a common query
definition base for several applications. The problem is we cannot us
a common result mapping, because objects vary in each application.

Unfortunally declaring two files, reports.xml and mappings.xml in the
config files would not work. I'm getting a lot of errors like 'There
is no result map named TestMap in this SqlMap.'. Is there any other
way to do this?

TIA,
Stefan

Re: statements and result maps in different files?

Posted by Graeme J Sweeney <ib...@gjsweeney.com>.
On Fri, 28 Jul 2006, Stefan Podkowinski wrote:

> Can anyone give advise how to seperate object mappings from statements
> in ibatis? We would like to create a file containing a few complex
> reporting queries with the intention to use it as a common query
> definition base for several applications. The problem is we cannot us
> a common result mapping, because objects vary in each application.

Have you tried XML entities? Something like

<!DOCTYPE sqlMap [
   <!ENTITY theResultMaps SYSTEM "result_maps.xml">
]>

<sqlMap>
   &theResultMaps;

   <!-- common queries -->

</sqlMap>

I use that to split up ANT build files though haven't tried it with 
iBatis.

-- 
Graeme -

Re: statements and result maps in different files?

Posted by Stefan Podkowinski <sp...@gmail.com>.
Thanks for your helpful answers. Changing the import order in my
config file fixed the problem. Now it works just as expected. :)

On 7/28/06, Larry Meadors <lm...@apache.org> wrote:
> This is a known bug.
>
> In your sqlmap config, be sure to include the file with the resultmaps
> BEFORE the file with the mapped statements. Also, you may have some
> namespace issues, too...kinda hard to tell without more details...
>
> You may also want to look at the <sql/> and <include/> tags for
> managing the queries.
>
> Larry
>
>
> On 7/28/06, Stefan Podkowinski <sp...@gmail.com> wrote:
> > Hello
> >
> > Can anyone give advise how to seperate object mappings from statements
> > in ibatis? We would like to create a file containing a few complex
> > reporting queries with the intention to use it as a common query
> > definition base for several applications. The problem is we cannot us
> > a common result mapping, because objects vary in each application.
> >
> > Unfortunally declaring two files, reports.xml and mappings.xml in the
> > config files would not work. I'm getting a lot of errors like 'There
> > is no result map named TestMap in this SqlMap.'. Is there any other
> > way to do this?
> >
> > TIA,
> > Stefan
> >
>

Re: statements and result maps in different files?

Posted by Larry Meadors <lm...@apache.org>.
This is a known bug.

In your sqlmap config, be sure to include the file with the resultmaps
BEFORE the file with the mapped statements. Also, you may have some
namespace issues, too...kinda hard to tell without more details...

You may also want to look at the <sql/> and <include/> tags for
managing the queries.

Larry


On 7/28/06, Stefan Podkowinski <sp...@gmail.com> wrote:
> Hello
>
> Can anyone give advise how to seperate object mappings from statements
> in ibatis? We would like to create a file containing a few complex
> reporting queries with the intention to use it as a common query
> definition base for several applications. The problem is we cannot us
> a common result mapping, because objects vary in each application.
>
> Unfortunally declaring two files, reports.xml and mappings.xml in the
> config files would not work. I'm getting a lot of errors like 'There
> is no result map named TestMap in this SqlMap.'. Is there any other
> way to do this?
>
> TIA,
> Stefan
>