ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Turkenkopf <dturk...@gmail.com>
Subject Re: Sharing iBATIS XML files between java applications
Date Tue, 02 Jun 2009 11:48:34 GMT
If you're using Spring 2.5.5 or higher and iBATIS 2.3.2 or higher, you can
define mappingLocations when you define your SqlMapFactoryBean.  This will
allow you to load different XML files in different cases, included those
contained in other jars.

Be careful though, because you still need a SQL Map configuration file and
that must contain at least one reference to a SQL map.  I have the main
config file point to an empty SQL map so I can load all my real
configurations through the Spring mechanism.  It's not an ideal solution,
but it meets my needs.

Hope this helps,

Dan Turkenkopf

On Tue, Jun 2, 2009 at 1:13 AM, E <evsub@michevan.id.au> wrote:

> Hi.
> I have a common library of code "C" that is shared between two separate
> java applications, "A" and "B".
> C includes a set of iBATIS XML files and related java classes that are used
> by both programs.
> However, each of A and B have some additional classes and XML files that
> are to be used as well as the common ones from C.  (All code is talking to
> the same database.)
> So far I have three possible solutions, none of which are ideal.
> 1) Refactor all iBATIS related classes and XML from A and B into C, so it's
> all in the one "module".
> 2) Have each of my main SQL Map XML configuration files also do <sqlMap
> resource="..."> for the XML resource files that are in C - which is a
> maintenance headache.
> 3) Create two SqlMapClient objects, one for C, and one for the application
> I happen to be in (either A or B).
> Any feedback on a better way to do this would be appreciated.
> E.

View raw message