ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Way to declare transactionManager section in a separate file and have it picked up?
Date Sat, 10 Jan 2009 21:06:38 GMT
You probably can't do it without a little coding.  But you already
know Spring can do this, so it must be possible - right?

The basic idea is that you leave the transaction configuration out of
the SqlMapConfig file, then apply the transaction manager
programmaticaly.

Take a look at the source for
org.springframework.orm.ibatis.SqlMapClientFactoryBean, you'll see how
they do it in the applyTransactionConfig method.

Jeff Butler



On Sat, Jan 10, 2009 at 12:43 PM, Rick <rickcr@gmail.com> wrote:
> sorry if this is in the documentation somewhere, but I haven't found
> it. (man, I'd love to be able to search in the PDF:). Anyway, I know I
> can use a properties file for declaring properties that can be
> substituted in in the transaction manager properties, but this
> persistence jar i'm creating, I'd like to allow the end user to decide
> how they want to set up the transaction manager. For example someone
> might want to use jndi which is only one property vs all the
> properties they might define if using simple datasource. I want the
> rest of the sql config though to not be exposed to the end user
> (that's bundled in my jar), I just want the end user to have to
> provide a transactionmanager section. How would I go about setting
> this up? I'm currently loading the slqmap config like:
>
> Reader reader = Resources.getResourceAsReader(sqlMapConfigLocation);
> sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
>
> But that only seems to take the location of a single file. Is there a
> way I can declare the transactionManager section in a separate file
> that will still be still in the classpath and have that picked
> up(merged?) with the sqlmap config file or used by the
> SqlMapClientBuilder?
>
> Thanks
>
> --
> Rick
>

Mime
View raw message