Re: Does DataContext.rollbackChanges() in 1.1.4 leave transient objects in toManyList relationships?

From: Alexis (alexis.tua..mail.com)
Date: Wed Apr 30 2008 - 06:59:56 EDT

  • Next message: Andrus Adamchik: "Re: Error when adding and then removing object from relationship before committing"

    Hi,

    i have the same issue with Cayenne 2.0 :
    Some objects are inserted and added in a commited object's to-many
    relationship.
    An exception occured, we rollback the changes but the new objects remain in
    the to-many relationship
    as transient objects !
    Is this a feature or a bug ?
    Is there a clean workaround ?

    Thanks for your answers

    Mike Kienenberger wrote:
    >
    > Yeah, I hit this behavior in a unit test, but I wasn't sure if it was
    > a Cayenne problem or something wrong that I did.
    >
    > This appears to fix the issue, although it's not really convenient:
    >
    > // Rollback changes may leave transient objects in toMany Lists.
    > if (PersistenceState.COMMITTED ==
    > dataObject.getPersistenceState())
    > {
    > dataObject.setPersistenceState(PersistenceState.HOLLOW);
    > }
    > dataObject.resolveFault();
    >
    >
    >
    > I've been working on maintenance for a Cayenne 1.1 project for the
    > last few months, and due to some local mods (custom local event
    > bridge, custom propagation of invalidation events between snapshots,
    > and other minor tweeks), trying to upgrade Cayenne isn't practical at
    > this point. I did finally upgrade it from 1.1R2 to 1.1.4, though :-)
    >
    > On 10/11/07, Andrus Adamchik <andru..bjectstyle.org> wrote:
    >> Good question... Without looking at 1.1 source code, I'd say yes. But
    >> I'd say running a test would be the best way to determine that.
    >> (1.1.4? when was that? :-))
    >>
    >> Andrus
    >>
    >>
    >> On Oct 10, 2007, at 11:06 PM, Mike Kienenberger wrote:
    >>
    >> > Should I expect that DataContext.rollbackChanges() in 1.1.4 leave
    >> > transient objects for new objects in toManyList relationships
    >> > containing that new object?
    >> >
    >> > I'm pretty sure that the answer is yes.
    >> >
    >>
    >>
    >
    >

    -- 
    View this message in context: http://www.nabble.com/Does-DataContext.rollbackChanges%28%29-in-1.1.4-leave-transient-objects-in-toManyList-relationships--tp13143656p16980077.html
    Sent from the Cayenne - User mailing list archive at Nabble.com.
    



    This archive was generated by hypermail 2.0.0 : Wed Apr 30 2008 - 07:00:31 EDT