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.

/Gwyn

On 12/11/2007, Toby Thain <[EMAIL PROTECTED]> 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

Reply via email to