Re: Why don't we use version-based optimistic locking?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Aug 29 2005 - 15:23:26 EDT

  • Next message: Gentry, Michael \(Contractor\): "RE: Lazily column retrieval"

    On Aug 29, 2005, at 3:06 PM, Gili wrote:

    > ... register a lots of new objects ...
    > ... flush objects to DB-layer of transaction ...
    > ... repeat 1000 times ...
    > ... commit/flush the transaction ...

    Actually I was totally wrong - you can have a transaction wrapping
    one or more DataContexts - container-managed transactions. I just
    don't use this functionality, so i forgot.

    (1) configure Cayenne DataDomain to use Container Managed
    Transactions in the Modeler.
    (2) initiate a J2EE transaction somehow ... I am less certain about
    your options here. It worked within the EJB environment. I guess
    Spring can also help here.
    (3) For each batch of objects create a new DataContext, then commit,
    dispose of this DataContext, and create a new one for the new batch.
    (4) at the end trigger a commit of the wrapper J2EE transaction.

    Andrus



    This archive was generated by hypermail 2.0.0 : Mon Aug 29 2005 - 15:23:28 EDT