cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Kienenberger" <mkien...@gmail.com>
Subject Re: Does DataContext.rollbackChanges() in 1.1.4 leave transient objects in toManyList relationships?
Date Thu, 11 Oct 2007 15:03:19 GMT
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 <andrus@objectstyle.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.
> >
>
>

Mime
View raw message