Re: Singletons in Cayenne and problems. Can I use multiple transactions?

From: Evgeny Ryabitskiy (evgeny.ryabitski..mail.com)
Date: Tue Dec 01 2009 - 11:12:47 EST

  • Next message: Andrus Adamchik: "Re: Singletons in Cayenne and problems. Can I use multiple transactions?"

    > if you have ideas,  let's discuss them.

    So first my idea is to change this method (It's confusing!!!):

    domain.createTransaction();

    A spend some time looking through code. Transaction is not aggregated
    to DataDomain (inside called static method of Transaction class) how I
    was thinking before. Only thing why it's where is parameter with
    defines to use External or Internal Transaction and... some Delegate
    for callbacks.
    If it's singleton and can be used across several DataDomains it should
    be more oblivious if we initialize it as a Singleton via static
    method.

    Callbacks can be add after initialization as a set of Delegates (now
    there can be only one so I can't say this transaction is fully
    cross-domain working).
    What I want to say: If we are using it as Singleton (in scope of one
    thread) then let's make it friendly-user singleton, not a headache for
    developers who are constructing huge system with multiple domains :)

    Evgeny.

    >
    >>> transactions, and while addressing one use case it breaks others (i.e.
    >>> other
    >>> users may need a single commit point across multiple DataDomains).
    >>
    >> Ok. Actually I has no differences between several domain-local
    >> transactions and one huge that is across multiple DataDomains.
    >> The question is Transaction is working well across multiple DataDomains?
    >
    > There's nothing magical about Transactions. In Cayenne they are a store of
    > JDBC Connection to ensure that multiple sub-operations within a given
    > operation get the same connection and consequently operate on the same db
    > data version.
    >
    > 2 possible caveats between domains when they reuse transactions:
    >
    > * They should both use either external or internal transactions (i.e. the
    > same transaction strategy).
    > * If they want completely separate connections, DataNode names should not
    > match. If they want to reuse connections from each other, they DataNode
    > names should match.
    >
    > Andrus
    >
    >
    >
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Dec 01 2009 - 11:13:21 EST