Re: Resetting an object back to committed state (including relationships)

Andrus Adamchik <[email protected]>
Newsgroups gmane.comp.java.cayenne.user
Message-ID <[email protected]>
"invalidateObjects" should invalidate relationships too. IIRC this worked exactly as you'd expect in a root context. I don't use nested contexts. Wonder if a bug crept in there?

Andrus


> On Oct 18, 2020, at 2:53 AM, Lon Varscsak <[email protected]> wrote:
> 
> I have a situation where I need to invalidate an object and have it go
> back to it's committed state (whether that's from the db or a parent
> context).  If I invalidate the object, it's attributes seem to do what I'm
> expecting, but it appears that it leaves relationships alone.  I need a way
> to invalidate all of it's relationships, restore those objects back to
> their committed state (maybe they've been deleted or modified...as well as
> get rid of any newly created objects).  How would I accomplish this?  A
> child context doesn't work in my case...because the user has already
> "saved" to the parent...it's that a later behavior triggers them to say,
> nah, never mind...I want the original object back.
> 
> Note: I'm pretty sure in EOF I just called invalidate objects on the main
> object and everything else was taken care of...not positive though.
> 
> Thanks in advance for the help!
> 
> -Lon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.