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 Matilda Östling <ma...@ladok.umu.se> on 2005/10/11 15:31:18 UTC

Including a SqlMapConfig.xml file

Hi, 
I have a little problem. How do I include a SqlMapConfig-file into another
SqlMapConfig-file. In our project we have a file called
CommonSqlMapConfig.xml which we would like to include in all other more
specific xml-files.

I have tried 
<sqlMap resource="se/ladok/batch/common/maps/CommonSqlMapConfig.xml"/> 
I do not get an errormessage while building the project but when running the
application the included xml-files in CommonSqlMapConfig.xml are not found.

Thanks in advance!
Best regards
/Matilda



Re: Including a SqlMapConfig.xml file

Posted by Larry Meadors <lm...@apache.org>.
You could use ant to do it.

Larry


On 10/11/05, Matilda Östling <ma...@ladok.umu.se> wrote:
> Hello,
>
> I have tried to include the xml-files using 'ENTITY', but it did not work.
>
> --------------------
> <!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
>     "http://www.ibatis.com/dtd/sql-map-config-2.dtd"> [
>         <!ENTITY common SYSTEM "relative/path/to/CommonSqlMapConfig.xml">
>         <!ENTITY someOtherPart SYSTEM "relative/path/to/sop.xml">
> ]>
>
> <!-- Keep the root structure in the main file -->
> <sqlmapconfig>
>   <!-- Include the contents of the common file like this -->
>   &common;
> </sqlmapconfig>
> --------------------
>
>
> I have also tried to use:
> ...
> <!ENTITY SB01 SYSTEM "file:../maps/sop.xml">
> ...
> But then the path to the xml-file must be absolute and that is not a
> solution since the application will be run at different machines...
>
> I would really appreciate help in this matter!
> Best regards
> /Matilda
>
>
> -----Original Message-----
> From: Daniel Henrique Ferreira e Silva [mailto:dhsilva@gmail.com]
> Sent: den 11 oktober 2005 16:11
> To: user-java@ibatis.apache.org
> Subject: Re: Including a SqlMapConfig.xml file
>
> Hi Matilda,
>
> That's because you're using a sqlMap tag to include a config file.
> That won't work afaik.
> Not sure there is a way to do that within iBATIS.
> But you can try xml includes. I guess they'd work fine.
>
> Hope that helped.
>
> Cheers,
> Daniel Silva.
>
>
>
> On 10/11/05, Matilda Östling <ma...@ladok.umu.se> wrote:
> > Hi,
> > I have a little problem. How do I include a SqlMapConfig-file into another
> > SqlMapConfig-file. In our project we have a file called
> > CommonSqlMapConfig.xml which we would like to include in all other more
> > specific xml-files.
> >
> > I have tried
> > <sqlMap resource="se/ladok/batch/common/maps/CommonSqlMapConfig.xml"/>
> > I do not get an errormessage while building the project but when running
> the
> > application the included xml-files in CommonSqlMapConfig.xml are not
> found.
> >
> > Thanks in advance!
> > Best regards
> > /Matilda
> >
> >
> >
>
>
>

RE: Including a SqlMapConfig.xml file

Posted by Matilda Östling <ma...@ladok.umu.se>.
Hello,

I have tried to include the xml-files using 'ENTITY', but it did not work. 

--------------------
<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
    "http://www.ibatis.com/dtd/sql-map-config-2.dtd"> [ 
	<!ENTITY common SYSTEM "relative/path/to/CommonSqlMapConfig.xml"> 
	<!ENTITY someOtherPart SYSTEM "relative/path/to/sop.xml"> 
]> 

<!-- Keep the root structure in the main file --> 
<sqlmapconfig> 
  <!-- Include the contents of the common file like this --> 
  &common; 
</sqlmapconfig> 
--------------------


I have also tried to use:
...
<!ENTITY SB01 SYSTEM "file:../maps/sop.xml">
...
But then the path to the xml-file must be absolute and that is not a
solution since the application will be run at different machines...

I would really appreciate help in this matter!
Best regards
/Matilda


-----Original Message-----
From: Daniel Henrique Ferreira e Silva [mailto:dhsilva@gmail.com] 
Sent: den 11 oktober 2005 16:11
To: user-java@ibatis.apache.org
Subject: Re: Including a SqlMapConfig.xml file

Hi Matilda,

That's because you're using a sqlMap tag to include a config file.
That won't work afaik.
Not sure there is a way to do that within iBATIS.
But you can try xml includes. I guess they'd work fine.

Hope that helped.

Cheers,
Daniel Silva.



On 10/11/05, Matilda Östling <ma...@ladok.umu.se> wrote:
> Hi,
> I have a little problem. How do I include a SqlMapConfig-file into another
> SqlMapConfig-file. In our project we have a file called
> CommonSqlMapConfig.xml which we would like to include in all other more
> specific xml-files.
>
> I have tried
> <sqlMap resource="se/ladok/batch/common/maps/CommonSqlMapConfig.xml"/>
> I do not get an errormessage while building the project but when running
the
> application the included xml-files in CommonSqlMapConfig.xml are not
found.
>
> Thanks in advance!
> Best regards
> /Matilda
>
>
>



Re: Including a SqlMapConfig.xml file

Posted by Daniel Henrique Ferreira e Silva <dh...@gmail.com>.
Hi Matilda,

That's because you're using a sqlMap tag to include a config file.
That won't work afaik.
Not sure there is a way to do that within iBATIS.
But you can try xml includes. I guess they'd work fine.

Hope that helped.

Cheers,
Daniel Silva.



On 10/11/05, Matilda Östling <ma...@ladok.umu.se> wrote:
> Hi,
> I have a little problem. How do I include a SqlMapConfig-file into another
> SqlMapConfig-file. In our project we have a file called
> CommonSqlMapConfig.xml which we would like to include in all other more
> specific xml-files.
>
> I have tried
> <sqlMap resource="se/ladok/batch/common/maps/CommonSqlMapConfig.xml"/>
> I do not get an errormessage while building the project but when running the
> application the included xml-files in CommonSqlMapConfig.xml are not found.
>
> Thanks in advance!
> Best regards
> /Matilda
>
>
>