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 Jeffrey Jones <jx...@verizon.net> on 2007/07/07 06:01:34 UTC

transaction help

New to ibatis, searched the archives on this but couldn't find the answer.
I would like to use the SqlMapClient startTransaction(),
commitTransaction(), endTransaction() methods.  From the documentation, I am
assuming you can do something as simple as this in your code and have
transaction support:

     sqlMap.startTransaction();

     // code to insert into table1

     // code to update table2

     // code to delete from table3

     sqlMap.commitTransaction();

 

This seems simple and if it works, I believe it should satisfy our
requirement.  Can someone explain to me how I need to setup my
SqlMapConfig.xml to use these calls?  Up to now, we have only done single
calls and use autocommit.  We are using MySQL but not Spring or Hibernate,
only ibatis for now.  Any assistance would be appreciated.  Thanks.

 


RE: transaction help

Posted by "Hemant.Kamatgi" <He...@target.com>.
In your sqlmapconfig.xml file ;

If your application is in the context of an AppServer; then the config
below should help:

 

  <transactionManager type="JTA" commitRequired="false">

      <property name="UserTransaction" value="java:comp/UserTransaction"
/>

    <dataSource type="JNDI">

      <property name="DataSource" value="java:comp/env/jdbc/XXX"/>

    </dataSource>

  </transactionManager>

 

Regards

 

________________________________

From: Jeffrey Jones [mailto:jx3@verizon.net] 
Sent: Friday, July 06, 2007 11:02 PM
To: user-java@ibatis.apache.org
Subject: transaction help

 

New to ibatis, searched the archives on this but couldn't find the
answer.  I would like to use the SqlMapClient startTransaction(),
commitTransaction(), endTransaction() methods.  From the documentation,
I am assuming you can do something as simple as this in your code and
have transaction support:

     sqlMap.startTransaction();

     // code to insert into table1

     // code to update table2

     // code to delete from table3

     sqlMap.commitTransaction();

 

This seems simple and if it works, I believe it should satisfy our
requirement.  Can someone explain to me how I need to setup my
SqlMapConfig.xml to use these calls?  Up to now, we have only done
single calls and use autocommit.  We are using MySQL but not Spring or
Hibernate, only ibatis for now.  Any assistance would be appreciated.
Thanks.