You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by Clinton Begin <cl...@gmail.com> on 2010/01/06 18:35:31 UTC

Re: Small suggestion - method for checking if a DB transaction is in progress

In iBATIS 3, the SqlSession is the transaction.  So if you have one, you're
in a transaction.  The one exception is if you create a SqlSession in
auto-commit mode, which is not in a transaction, but also cannot be turned
into a transaction.  Thus it would be irrelevant.

Clinton

On Wed, Jan 6, 2010 at 1:04 AM, stefcl <st...@gmail.com> wrote:

>
> Hello,
>
> I wonder if it would be possible to add a method to SqlSession that would
> tell if a database transaction has been started or not.
> Something like :
>
> boolean SqlSession.isTransactionInProgress()
>
> It would allow a method that receives the SqlSession in parameter to know
> if
> the caller has already started a transaction. Based upon that information,
> the method could decide either to start a transaction (that it would commit
> before returning) or use the active one.
>
> I think it could be useful in scenarios where AOP frameworks can't be used.
> Kind regards
> --
> View this message in context:
> http://old.nabble.com/Small-suggestion---method-for-checking-if-a-DB-transaction-is-in-progress-tp27026807p27026807.html
> Sent from the iBATIS - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: dev-help@ibatis.apache.org
>
>

Re: Small suggestion - method for checking if a DB transaction is in progress

Posted by stefcl <st...@gmail.com>.
Right...
Actually, it seems that I was mixing elements from v2 and v3 APIs. My bad...
Sorry!


Clinton Begin wrote:
> 
> In iBATIS 3, the SqlSession is the transaction.  So if you have one,
> you're
> in a transaction.  The one exception is if you create a SqlSession in
> auto-commit mode, which is not in a transaction, but also cannot be turned
> into a transaction.  Thus it would be irrelevant.
> 
> Clinton
> 
> On Wed, Jan 6, 2010 at 1:04 AM, stefcl <st...@gmail.com> wrote:
> 
>>
>> Hello,
>>
>> I wonder if it would be possible to add a method to SqlSession that would
>> tell if a database transaction has been started or not.
>> Something like :
>>
>> boolean SqlSession.isTransactionInProgress()
>>
>> It would allow a method that receives the SqlSession in parameter to know
>> if
>> the caller has already started a transaction. Based upon that
>> information,
>> the method could decide either to start a transaction (that it would
>> commit
>> before returning) or use the active one.
>>
>> I think it could be useful in scenarios where AOP frameworks can't be
>> used.
>> Kind regards
>> --
>> View this message in context:
>> http://old.nabble.com/Small-suggestion---method-for-checking-if-a-DB-transaction-is-in-progress-tp27026807p27026807.html
>> Sent from the iBATIS - Dev mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: dev-help@ibatis.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/Small-suggestion---method-for-checking-if-a-DB-transaction-is-in-progress-tp27026807p27056295.html
Sent from the iBATIS - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ibatis.apache.org
For additional commands, e-mail: dev-help@ibatis.apache.org