Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 45259 invoked from network); 12 Nov 2007 17:56:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Nov 2007 17:56:54 -0000 Received: (qmail 21421 invoked by uid 500); 12 Nov 2007 17:56:40 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 21100 invoked by uid 500); 12 Nov 2007 17:56:39 -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 21089 invoked by uid 99); 12 Nov 2007 17:56:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Nov 2007 09:56:39 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [204.15.192.18] (HELO toronto2.smartgames.ca) (204.15.192.18) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Nov 2007 17:57:27 +0000 Received: from [10.143.176.10] (unknown [10.143.176.10]) by toronto2.smartgames.ca (Postfix) with ESMTP id 1531F2B7 for ; Mon, 12 Nov 2007 12:59:00 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: References: <0E917E26-AC4F-4B89-BB3F-B594899F4389@smartgames.ca> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Toby Thain Subject: Re: proper use of start/endTransaction() Date: Mon, 12 Nov 2007 15:56:17 -0200 To: user-java@ibatis.apache.org X-Mailer: Apple Mail (2.752.2) X-Virus-Checked: Checked by ClamAV on apache.org On 12-Nov-07, at 3:27 PM, Gwyn Evans wrote: > No idea if it's possible, but the first case allows for the > transaction being created then an exception being thrown in the > 'start' operation, whereas with the second case, that would leave the > transaction open. Wouldn't that be a bug? --Toby > > /Gwyn > > On 12/11/2007, Toby Thain wrote: >> Hi, >> >> A little thought has been bothering me for a while and I thought I >> would put it to the experts. >> >> The iBATIS manual advises the following logic for transactions: >> >> try { >> sqlMap.startTransaction (); >> // ...queries >> sqlMap.commitTransaction (); >> } finally { >> sqlMap.endTransaction (); >> } >> >> I am curious if it would be more strictly correct to: >> >> sqlMap.startTransaction (); >> try { >> // ...queries >> sqlMap.commitTransaction (); >> } finally { >> sqlMap.endTransaction (); >> } >> >> In the event that startTransaction() itself throws an Exception... >> >> Thoughts? >> --Toby >> > > > -- > Download Wicket 1.3.0-rc1 now! - http://wicketframework.org