ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davide Rogora" <drog...@unionefiduciaria.it>
Subject R: url attribute of <sqlMap> tag
Date Thu, 24 Jul 2008 09:40:37 GMT
Thanks for your reply Larry.
So there is no way to include an xml file (that is not in the classpath)
using a relative path?


-----Messaggio originale-----
Da: Larry Meadors [mailto:larry.meadors@gmail.com]
Inviato: mercoledì 23 luglio 2008 15.35
A: user-java@ibatis.apache.org
Oggetto: Re: url attribute of <sqlMap> tag

No: URLs are absolute names.

Depending on how you initialize your SqlMapClient, you might be able
to pass a base bath as a parameter, and have your web app tell it
where the web root is, then build a file:// url from that, but I don't
see any advantage to doing that. Look at the SqlMapCientBuilder to see
how to do that.

FWIW, I wouldn't recommend this. It's extra work without a reward.


On Wed, Jul 23, 2008 at 7:18 AM, Davide Rogora
<drogora@unionefiduciaria.it> wrote:
> Hi,
> Actually my iBatis xml config files are under the classpath so, to include
> an xml file in the in the main configuration file (that is under
> WEB-INF/iBatis folder) I usually write:
> <sqlMap resource="it/mypakage/Example.xml" />
> (and it works)
> I need to move all my files under WEB-INF/iBatis directory of my web
> application.
> I read iBatis manual and tried with the "url" attribute, like this:
> <sqlMap url="file:///c:/myProject/www/WEB-INF/iBatis/Example.xml" />
> and it works!
> Now I want to make the path relative to the project (and not absolute to
> hard drive c: like in the above example).
> I tried with ;
> <sqlMap url="file:///WEB-INF/iBatis/Example.xml" /> and
> <sqlMap url="file:///Example.xml" /> and
> <sqlMap url="file:Example.xml" /> and
> and a million of other ways, but it doesn't work
> How is the correct way to use a relative path with the url attribute?
> Thanks,
> Davide.

View raw message