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 "Wulf, Andrew" <AH...@firstcommand.com> on 2005/04/27 19:44:35 UTC

Ibatis property file issue

We develop our apps in two environments, Eclipse/IntelliJ for business
logic and BEA Weblogic Workshop for the portal UI. The problem is in
creating a single iBatis property file that will work in both
environments.

If I use the classpath for the property file and use

  <sqlMap resource="maps/Office_View.xml"/>

It works in E/I but since Workshop doesn't move non-class files around
in its "deployment" procedure to Weblogic server the files don't make it
into the classpath (which you basically have no control over).

If I do the URL method and do

<sqlMap url="file:./maps/Active_Agent_Office_View.xml"/>

This doesn't work in E/I unless the url is relative to the working
directory and only works in workshop if you stick everything relative to
the domain root directory.

The basic problem is that iBatis uses

    URL url = new URL(urlString);

Which in the case of a relative url doesn't work unless its relative to
the current working directory, NOT the ibatis property file.

I would like to see a change to sqlMap xml definition to indicate that
the url reference is relative to the iBatis property file. This was if I
can load the main property file iBatis can easily load the sqlmap files
from the same directory.

In the meantime, any ideas? I can move stuff around with ANT for working
in Workshop but it's irritating.

- Andrew



Re: Ibatis property file issue

Posted by Larry Meadors <la...@gmail.com>.
There really is no such thing as a "relative" URL.

If you wanted to, you could specify the path in the properties file like 
this:

sqlMapHome=/usr/local/whatever


Then use this in the SqlMapConfig.xml:

<sqlMap url="file://${sqlMapHome}/maps/Active_Agent_Office_View.xml"/> 

Larry


On 4/27/05, Wulf, Andrew <AH...@firstcommand.com> wrote:
> 
> We develop our apps in two environments, Eclipse/IntelliJ for business 
> logic and BEA Weblogic Workshop for the portal UI. The problem is in 
> creating a single iBatis property file that will work in both environments.
> 
> If I use the classpath for the property file and use 
> 
> <sqlMap resource="maps/Office_View.xml"/> 
> 
> It works in E/I but since Workshop doesn't move non-class files around in 
> its "deployment" procedure to Weblogic server the files don't make it into 
> the classpath (which you basically have no control over).
> 
> If I do the URL method and do 
> 
> <sqlMap url="file:./maps/Active_Agent_Office_View.xml"/> 
> 
> This doesn't work in E/I unless the url is relative to the working 
> directory and only works in workshop if you stick everything relative to the 
> domain root directory.
> 
> The basic problem is that iBatis uses 
> 
> URL url = new URL(urlString); 
> 
> Which in the case of a relative url doesn't work unless its relative to 
> the current working directory, NOT the ibatis property file.
> 
> I would like to see a change to sqlMap xml definition to indicate that the 
> url reference is relative to the iBatis property file. This was if I can 
> load the main property file iBatis can easily load the sqlmap files from the 
> same directory.
> 
> In the meantime, any ideas? I can move stuff around with ANT for working 
> in Workshop but it's irritating. 
>