ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brandon Goodin <brandon.goo...@gmail.com>
Subject Re: ibatis and global transactions
Date Fri, 20 May 2005 17:47:46 GMT
Sorry, I should be more clear.

You would have a separate sqlmap for each datasource. Your sqlmap
would be tied to the datasource via JNDI. You would also have your
global transaction specified as a JNDI context as well.

So each datasource has a sqlmap, each sqlmap has a SINGLE JNDI
specified datasource. All sqlmaps that should use the same JTA would
configure it.

<transactionManager type="JTA" >
<property name="UserTransaction" value="java:/ctx/con/UserTransaction"/>
<dataSource type="JNDI">
<property name="DataSource" value="java:comp/env/jdbc/jpetstore"/>
</dataSource>
</transactionManager>

What you can't do is have several datasources defined in ONE sqlmap config.

Depending on how complex your needs are. Sometimes EXTERNAL is better.
This is especially true when you have to maintain transactions across
several write operations that span across several user actions before
it finally commits. I think this is what Steven is running in to.

Brandon


On 5/20/05, Rafiq, Adnan <arafiq@carreker.com> wrote:
> Brandon,
> 
> [ ... The JTA option in ibatis is tied to a single datasource. ...]
> 
> In my project, I am using a JTA transaction manager and have multiple data
> sources (using XA-drivers). So far, I have not seen anything unusual. Is
> there something I need to be aware of when using JTA and distributed
> transactions?
> 
> -----Original Message-----
> From: Brandon Goodin [mailto:brandon.goodin@gmail.com]
> Sent: Friday, May 20, 2005 8:19 AM
> To: ibatis-user-java@incubator.apache.org
> Subject: Re: ibatis and global transactions
> 
> 
> You can manage your transactions with EXTERNAL of JTA. I believe that
> EXTERNAL is the better route to go in this case. This means that you
> will need to configure and manually start and stop your transactions
> outside of ibatis. Search the DAO pdf doc and the SQL Maps pdf doc for
> external to get more information.
> 
> The JTA option in ibatis is tied to a single datasource. So, as far as
> global transactions that span databases... I don't think it would be
> that simple to accomplish with iBatis JTA support.
> 
> Your other option is to use Spring (which would mean you get rid of
> the dao.xml) and setup sqlMapConfigs for each database you are
> accessing. Then you could use Spring's transaction management to
> manage transactions across any data access implementations you might
> have.
> 
> Brandon
> 
> On 5/20/05, James, Steven <Steven.James@logicacmg.com> wrote:
> > Hi
> >
> > I working on an application where the services and buisness domain objects
> are sitting on a server with ibatis providing the data access layer support.
> > The clients which are swt client connect to the server and via rpc calls.
> > Our customer want us to rollback all db changes during a user login should
> they not want to commit (Commit in our case is not commit to db but to
> cascade data changes to other machines) ie they want to undo the changes
> made to the db ie rollback. Is ibatis capable of providing this global
> transaction that spans a users session if you like.
> >
> > In the daomanager api there is talk of 2 phase commits but i dont think
> this is the same thing?
> >
> > we are using mysql and the jdbc connector 3.1.6, the jdk is 1.4.2 no j2ee
> application server.
> >
> > many thanks
> >
> > steve..
> >
> > This e-mail and any attachment is for authorised use by the intended
> recipient(s) only. It may contain proprietary material, confidential
> information and/or be subject to legal privilege. It should not be copied,
> disclosed to, retained or used by, any other party. If you are not an
> intended recipient then please promptly delete this e-mail and any
> attachment and all copies and inform the sender. Thank you.
> >
>

Mime
View raw message