Re: revertChanges method removed?

From: Christoph Sturm (christoph.stur..mail.com)
Date: Wed Apr 19 2006 - 09:18:08 EDT

  • Next message: Andrus Adamchik: "Re: revertChanges method removed?"

    hey andrus!

    On 4/19/06, Andrus Adamchik <andru..bjectstyle.org> wrote:
    > No, there is no automatic rollback - Cayenne leaves it up to the user
    > whether to retry commit or not. So if you used revertChanges()
    > before, you just replace it with 'rollbackChanges' or
    > 'rollbackChangesLocally', whichever applies.

    Sorry, I'm new to cayenne. I'm trying to track down a problem with
    code that i didnt write.

    I'm trying to figure out which one of the rollback methods is the
    right one for me :)
    If I have multiple transactions running at the same time, and in one
    of them a commit fails, will it roll back all the other transactions
    too if I use rollbackChanges()?

    thanks
     chris

    >
    > Andrus
    >
    >
    > On Apr 19, 2006, at 4:52 PM, Christoph Sturm wrote:
    >
    > > hey andrus!
    > >
    > > thanks for your fast reply!
    > >
    > > right now i have this pattern:
    > >
    > > try {
    > > getCayennecontext().commitChanges();
    > > } catch (CayenneRuntimeException e) {
    > > getCayennecontext().revertChanges();
    > > }
    > >
    > >
    > > now my question is: is it necessary to call rollbackchanges after
    > > commitChanges failed, or does it rollback automatically if it fails?
    > >
    > > regards
    > > chris
    > >
    > > On 4/19/06, Andrus Adamchik <andru..bjectstyle.org> wrote:
    > >> Chris,
    > >>
    > >> The method fell victim to the pre-beta refactoring effort - we needed
    > >> to reconcile new ObjectContext and existing DataContext APIs, so we
    > >> settled on naming closer to 1.1 ('revertChanges' was introduced
    > >> during one of the 1.2 milestones). Currently the context has two
    > >> methods that undo the changes:
    > >>
    > >> * rollbackChanges (cascades revert to parent contexts)
    > >> * rollbackChangesLocally (reverts locally)
    > >>
    > >> Both are equivalent unless you are using nested DataContrexts or
    > >> remote object persistence.
    > >>
    > >> Andrus
    > >>
    > >>
    > >>
    > >> On Apr 19, 2006, at 4:38 PM, Christoph Sturm wrote:
    > >>
    > >>> Hey guys!
    > >>>
    > >>> I am upgrading from M11 to b2 and it looks like the revertChanges
    > >>> method was removed. I cant find anything in the releasenotes, so i'd
    > >>> like to know if it was just renamed or removed, and if it was
    > >>> removed
    > >>> why it was removed.
    > >>>
    > >>> thanks
    > >>> chris
    > >>>
    > >>> --
    > >>> christoph.stur..mail.com
    > >>>
    > >>
    > >>
    > >
    > >
    > > --
    > > christoph.stur..mail.com
    > >
    >
    >

    --
    christoph.stur..mail.com
    



    This archive was generated by hypermail 2.0.0 : Wed Apr 19 2006 - 09:18:34 EDT