Re: Transaction Isolation level

From: Martin Thelian (martin.thelia..ovo.cc)
Date: Thu Oct 04 2007 - 06:07:07 EDT

  • Next message: Andrus Adamchik: "Re: Transaction Isolation level"

    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



    This archive was generated by hypermail 2.0.0 : Thu Oct 04 2007 - 06:10:50 EDT