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 Rajaram_Viswanathan <Ra...@Satyam.com> on 2006/04/28 12:57:28 UTC

FW: Ibatis Transactions across multiple DAO objects

 

________________________________

From: Rajaram_Viswanathan
Sent: Fri 4/28/2006 12:22 PM
To: user-java@ibatis.apache.org
Subject: Ibatis Transactions across multiple DAO objects


Hello All,
I wanted to control  ibatis transactions manually in my application.
I had used daoManagaer.StartTransaction/endTransaction().
Following is the code:
This code is in a service class which would be called by the action class to do insert operations
 

class Myservice extends BaseService{

public Bean insertPrimaryContent(Bean bean)
   {
   try{
    daoManager.startTransaction();

//This function is available in the base service class using the baseDao object obtained     

//using getDao(BaseDao.class)   method    in    base service.       

super.callGenericInsertStoredProc();

     //Updations are done seperately on the inserted data.

     //This below functions are in this class and uses myDao obtained using getDao(MyDao.class) method in category   service

     UpdateRelatedProperities();  //Mark 1

     UpdateRelatedTables();         //Mark 2

      .....
     daoManager.commitTransaction();
 }finally{
 daoManager.endTransaction();
 }
   
  return bean;
 }

}

 

Since I handle transactions manually,commit is not done in my stored procs.

But if any of the exception occurs at Mark 1 or Mark 2(see comments) ,The operations done by the callGenericInsertStoredProc() is not rolled back but mark1 and mark2 operations are rolled back.

Can you please tell me how to solve this problem?

I want all the above things to happen as single atomic transaction(All or None).

Please let me know if you have solution for the above problem.

 



DISCLAIMER:
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.

RE: Ibatis Transactions across multiple DAO objects

Posted by Rajaram_Viswanathan <Ra...@Satyam.com>.
Hello,
Any idea on this issue?

________________________________

From: Rajaram_Viswanathan
Sent: Fri 4/28/2006 4:27 PM
To: user-java@ibatis.apache.org
Subject: FW: Ibatis Transactions across multiple DAO objects


 

________________________________

From: Rajaram_Viswanathan
Sent: Fri 4/28/2006 12:22 PM
To: user-java@ibatis.apache.org
Subject: Ibatis Transactions across multiple DAO objects


Hello All,
I wanted to control  ibatis transactions manually in my application.
I had used daoManagaer.StartTransaction/endTransaction().
Following is the code:
This code is in a service class which would be called by the action class to do insert operations
 

class Myservice extends BaseService{

public Bean insertPrimaryContent(Bean bean)
   {
   try{
    daoManager.startTransaction();

//This function is available in the base service class using the baseDao object obtained     

//using getDao(BaseDao.class)   method    in    base service.       

super.callGenericInsertStoredProc();

     //Updations are done seperately on the inserted data.

     //This below functions are in this class and uses myDao obtained using getDao(MyDao.class) method in category   service

     UpdateRelatedProperities();  //Mark 1

     UpdateRelatedTables();         //Mark 2

      .....
     daoManager.commitTransaction();
 }finally{
 daoManager.endTransaction();
 }
   
  return bean;
 }

}

 

Since I handle transactions manually,commit is not done in my stored procs.

But if any of the exception occurs at Mark 1 or Mark 2(see comments) ,The operations done by the callGenericInsertStoredProc() is not rolled back but mark1 and mark2 operations are rolled back.

Can you please tell me how to solve this problem?

I want all the above things to happen as single atomic transaction(All or None).

Please let me know if you have solution for the above problem.

 



DISCLAIMER:
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.