cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Transaction Isolation level
Date Thu, 04 Oct 2007 10:21:34 GMT

On Oct 4, 2007, at 1:07 PM, Martin Thelian wrote:

> Andrus Adamchik schrieb:
>>> and is there a way to change it to use serializable transactions?
>> There's no direct API (maybe we should add it to Cayenne Transaction
>> in 3.0?), but you can enable serializable transactions by wrapping
>> your code in a Cayenne transaction manually [1] (see "User-Defined
>> Transaction Scope" down the bottom), and setting Connection  
>> properties
>> by hand.
> Thank you for this tip.
> It seems to work fine, except that the connection with the changed
> isolation level is returned to pool once transaction.commit() is  
> called
> by thread1, and therefore the next thread (thread2) gets this  
> connection
> from pool, but with the changed transation-isolation-level. A
> race-condition between thead1 and thread2 could arise if the
> isolation-level would be set back by thread1 after the
> transaction-commit. So each thread in the system would need to  
> check the
> transaction-isolation-level of a connection to ensure that the proper
> isolation-level is used.
>
> Martin

Or you can reset the state in the "finally" block of the manual  
transaction.

Andrus


Mime
View raw message