RE: Multiple Data Contexts?

From: Gentry, Michael \(Contractor\) ("Gentry,)
Date: Mon Jan 23 2006 - 09:32:04 EST

  • Next message: Dave Merrin: "RE: Multiple Data Contexts?"

    I'm not sure what your application is trying to do, but if it is
    session-based (web application), you generally want at least one
    DataContext per session. Also, many portions of DataContext are
    synchronized, such as commitChanges(), so you wouldn't have 10 parallel
    commits within a single DataContext. A commitChanges does all of it's
    work within a single transaction unless you are using the container
    managed transactions, which relies on the container for transaction
    management.

    If you could tell us a bit more about what you are trying to accomplish,
    we could provide more advice.

    /dev/mrg

    -----Original Message-----
    From: Dave Merrin [mailto:dmerri..pasystems.co.uk]
    Sent: Monday, January 23, 2006 7:00 AM
    To: cayenne-use..bjectstyle.org
    Subject: Multiple Data Contexts?

    Hi,

    I'd like to know if it is worth creating any more than one DataContext
    for
    the same database? i.e. if I want to be able to run 10 database queries
    at
    once is there any need for 10 DataContext objects? Will the underlying
    connection pooling sort this out for me?

    What would happen if I brought in a transaction system to deal with
    database
    transactions? Would starting a transaction automatically take one of the
    connections for the entire period the transaction is open?

    Cheers,

    Dave



    This archive was generated by hypermail 2.0.0 : Mon Jan 23 2006 - 09:32:07 EST