ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: ROLLBACK actions being seen on the database
Date Tue, 22 Feb 2005 20:47:14 GMT
Yes, this is normal.

Some JDBC drivers require a rollback to "reset" the state.  This is
actually a function of the connection pool, iBATIS doesn't do this. 
SimpleDataSource (the one that comes with iBATIS) does implement this.
 You can try DBCP to see if it works better for you, or preferrably,
use an app server managed DataSource.

Cheers,
Clinton


On Tue, 22 Feb 2005 11:03:08 -0600, David Putnam <dputnam@wellsfargo.com> wrote:
>  
> 
> All, 
> 
> I am writing a performance critical stand-alone java application using
> iBatis.  I am noticing ROLLBACK actions at the database that I can't
> explain, but I do have an hypothesis. 
> 
> Here is a code fragment: 
>         boolean done = false; 
>         int retry = 0; 
>         while ((retry < maxDeadlockRetry) && !done) { 
>             try { 
>                 sqlMap.startTransaction(); 
>                 switch (mode) { 
>                     case 1: 
>                         updateInvestor(investor, customer); 
>                         break; 
>                     case 2: 
>                         createInvestorLink(investor, customer); 
>                         updateInvestor(investor, customer); 
>                         break; 
>                     case 3: 
>                         investor = createInvestor(customer); 
>                         createInvestorLink(investor, customer); 
>                         break; 
>                 } 
>                 process.save(sqlMap); 
>                 sqlMap.commitTransaction(); 
>                 done = true; 
>             } catch (SQLException e) { 
>                 logger.error(e); 
>             } finally { 
>                 try { 
>                     sqlMap.endTransaction(); 
>                 } catch (SQLException e) { 
>                     logger.error(e); 
>                 } 
>             } // end of try 
>         } // end of deadlock retry 
> 
> I think that even though the transaction is committed, the endTransaction
> issues a ROLLBACK to the data server.  No data is lost because it has been
> committed, but this incurs another round trip to the data server.  I tried
> to be more explicit about when a rollback should occur, but I found trouble
> returning connections to the pool without the endTransacction in the finally
> clause. 
> 
> Is this working as designed?  
> 
> Thanks, 
> David Putnam 
> Wells Fargo Funds Management, LLC 
> One Hundred Heritage Reserve 
> Menomonee Falls, WI 53051-4400 
> MAC:   N9882-030 
> Voice: 414-359-3678 
>  
>  
>  
> 
> *****DISCLOSURE STATEMENT***** 
> This transmission may contain information which is confidential, proprietary
> and privileged.  If you are not the individual or entity to which it is
> addressed, note that any review, disclosure, copying, retransmission or
> other use is strictly prohibited.  If you received this transmission in
> error, please notify the sender immediately and delete the material from
> your system.  This transmission is for informational purposes only, and is
> not intended as an offer or solicitation for the purchase or sale of any
> financial instrument or as an official confirmation of any transaction.  Any
> information regarding specific investments or other products is not
> warranted as to completeness or accuracy and is subject to change without
> notice.

Mime
View raw message