Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 26054 invoked from network); 22 Jan 2007 16:45:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Jan 2007 16:45:24 -0000 Received: (qmail 44925 invoked by uid 500); 22 Jan 2007 16:45:27 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 44910 invoked by uid 500); 22 Jan 2007 16:45:27 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 44899 invoked by uid 99); 22 Jan 2007 16:45:27 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jan 2007 08:45:27 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [140.185.212.88] (HELO ptmexu03os.ptc.pentagon.mil) (140.185.212.88) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jan 2007 08:45:19 -0800 Received: by ptmexu03os.ptc.pentagon.mil with Internet Mail Service (5.5.2656.59) id ; Mon, 22 Jan 2007 16:45:10 -0000 Message-ID: From: "Yee, Richard K CTR DMDC" To: "'user-java@ibatis.apache.org'" Subject: RE: Autocommit not properly handled in Ibatis. Date: Mon, 22 Jan 2007 16:42:48 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C73E44.29045EC8" X-Virus-Checked: Checked by ClamAV on apache.org This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C73E44.29045EC8 Content-Type: text/plain Antohi, It looks to me that the code does exactly what Clinton says. If autocommit is on, iBATIS turns it off and thus does not use autocommit to commit changes to the DB. -Richard -----Original Message----- From: Cornel Antohi [mailto:cantohi@kepler-rominfo.com] Sent: Monday, January 22, 2007 2:37 AM To: user-java@ibatis.apache.org Subject: Re: Autocommit not properly handled in Ibatis. Hi Clinton, 1) What do you mean by "iBATIS never uses AutoCommit"? Here is what I found in: com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction --> private void init() throws SQLException, TransactionException // AutoCommit if (connection.getAutoCommit()) { connection.setAutoCommit(false); } Thank you, Cornel ----- Original Message ----- From: "Clinton Begin" < clinton.begin@gmail.com> To: < user-java@ibatis.apache.org> Sent: Friday, January 19, 2007 8:52 AM Subject: Re: Autocommit not properly handled in Ibatis. A few things: 1) iBATIS never uses AutoCommit. 2) setCommitRequired has nothing to do with AutoCommit. iBATIS uses deferred commits to avoid unecessary commits when no non-queries have been issued. And setCommitRequired is actually parameterized and can be set with 3) You'll need to post your code so we can see what it's doing. Are you calling startTransaction()? Are you using setUserConnection? Or openSession(conn)? I'm sure with the right information we can resolve this for you easily. Clinton On 1/18/07, Yuvraj Shinde < Yuvraj.Shinde@sos.sungard.com> wrote: > > > > > Hi all, > > > > I want to know how to handle auto commit in ibatis.if I am saving two > records and if I get an exception while saving second record the first > record saved should be rolled back. > > But ibatis is saving the first record. How I should handle this even > though the auto commit property is explicitly set to false. > > > > Even though AutoCommit value is set to false. Rollback of Transaction is > not working. > > I found one Issue in GeneralStatement.java. > > On line 52 request.getSession().setCommitRequired(true); > > > > Here Auto commit is hard coded it should be parameterized so that it will > take value from "Auto commit" property of SqlMapConfig.xml. > > Please correct me if I am wrong.please send me a solution. > > > > Regards > > Yuvrajs > > > > > > > > > > Yuvraj Shinde * Senior Software Engineer - Zainet* SunGard * Offshore > Services * > Pride Portal,CTS No 103A/5A/1A/1B Bhamburda,Senapati Bapat Road, > shivajinagar,Pune 411016 > Tel Direct +91 20 66248045 * Main +91 20 66248000 * Fax +91 20 25606222 > yuvraj.shinde@sos.sungard.com * www.sungard.com > > > > > Success is never ending and failure is never final. > > ------_=_NextPart_001_01C73E44.29045EC8 Content-Type: text/html Message
Antohi,
It looks to me that the code does exactly what Clinton says. If autocommit is on, iBATIS turns it off and thus does not use autocommit to commit changes to the DB.
 
-Richard
 
-----Original Message-----
From: Cornel Antohi [mailto:cantohi@kepler-rominfo.com]
Sent: Monday, January 22, 2007 2:37 AM
To: user-java@ibatis.apache.org
Subject: Re: Autocommit not properly handled in Ibatis.

Hi Clinton,
 
1) What do you mean by "iBATIS never uses AutoCommit"? Here is what I found in:

com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction --> private void init() throws SQLException, TransactionException

// AutoCommit
if (connection.getAutoCommit()) {
    connection.setAutoCommit(false);
}
 
 
Thank you,
Cornel
 
----- Original Message -----
From: "Clinton Begin" <clinton.begin@gmail.com>
Sent: Friday, January 19, 2007 8:52 AM
Subject: Re: Autocommit not properly handled in Ibatis.

A few things:

1) iBATIS never uses AutoCommit.

2) setCommitRequired has nothing to do with AutoCommit.  iBATIS uses
deferred commits to avoid unecessary commits when no non-queries have
been issued.  And setCommitRequired is actually parameterized and can
be set with <transactionManager ... commitRequired="true">

3) You'll need to post your code so we can see what it's doing.  Are
you calling startTransaction()?  Are you using setUserConnection?  Or
openSession(conn)?

I'm sure with the right information we can resolve this for you easily.

Clinton

On 1/18/07, Yuvraj Shinde <
Yuvraj.Shinde@sos.sungard.com> wrote:
>
>
>
>
> Hi all,
>
>
>
>    I want to know how to handle auto commit in ibatis.if I am saving two
> records and if I get an exception while saving second record the first
> record saved should be rolled back.
>
>   But ibatis is saving the first record. How I should handle this even
> though the auto commit property is explicitly set to false.
>
>
>
>    Even though AutoCommit value is set to false. Rollback of Transaction is
> not working.
>
>    I found one Issue in GeneralStatement.java.
>
>    On line 52  request.getSession().setCommitRequired(true);
>
>
>
>    Here Auto commit is hard coded it should be parameterized so that it will
> take value from "Auto commit" property of  SqlMapConfig.xml.
>
>    Please correct me if I am wrong.please send me a solution.
>
>
>
> Regards
>
> Yuvrajs
>
>
>
>
>
>
>
>
>
> Yuvraj Shinde * Senior Software Engineer -  Zainet*  SunGard * Offshore
> Services *
>  Pride Portal,CTS No 103A/5A/1A/1B Bhamburda,Senapati Bapat Road,
> shivajinagar,Pune 411016
>  Tel Direct +91 20 66248045 * Main +91 20 66248000 * Fax +91 20 25606222
yuvraj.shinde@sos.sungard.com * www.sungard.com
>
>
>
>
> Success is never ending and failure is never final.
>
>
------_=_NextPart_001_01C73E44.29045EC8--