ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prashanth Sukumaran <prashanthsukuma...@yahoo.com>
Subject Re: Multiple DaoManagers + transactions
Date Thu, 11 Aug 2005 19:38:27 GMT
Hi Louis,

Logically it should not.  Coz., they are two different instances.  Each DAOManger will have
own Connection object when they started respective transactions.  So the commit will happen
respectively connection objects. Right.

For ex., when you say startTransaction() deep inside the ibatis code you have

         new JdbcDaoTransaction(dataSource); for a JDBC and similarly for JTA, SQLMap etc.

Each of these hold a connection object and hence should not colide with each other.


Prashanth Sukumaran.

--- Louis Letourneau <louis.letourneau@mail.mcgill.ca> wrote:

> Hello,
>   I'm trying to understand the problems/issues of using multiple DaoManagers in the same
> application.
> Say I have 2 jars:
> MyApp.jar
> TheirLib.jar
> Both use Ibatis DAO. So, somewhere in their initialization, each makes a call to
> DaoManagerBuilder.buildDaoManager(...) and keeps their DaoManager instance somewhere.
> If in a thread I call a method that uses the daomanager of MyApp and in the same method
I use
> the daomanager of TheirLib, won't the first commit of the 2 commit everything?
> ie:
> // Code in MyApp.jar
> public void testMethod() {
>   daoManager_.startTransaction();
>   try{
>     doSomethingWithTheAppDaos();
>     TheirLibMethod(); <--- Somewhere in here there is a theirLibDaoManager.commitTransaction();
>     daoManager_.commitTransaction();
>   }
>   finally {
>     daoManager.endTransaction();
>   }
> }
> Since the contexts/transactions are kept in the TLS (thread local storage) doesn't multiple
> daomanager instances step on eachother (as long as they are used in the same thread)?
> Thanks
> Louis

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

View raw message