Re: Change tracking API in Cayenne

John Huss <[email protected]>
Newsgroups gmane.comp.java.cayenne.devel
Message-ID <CAOUwSGtWFRNjcQdZCm_+B48tk9N0jpd03gXy3rAOoVRbBzgtrA@mail.gmail.com>
I haven't worked with the GraphDiff API much, but it's not super easy to
turn a GraphDiff into something immediately useful.

When I've needed things like this I've usually constructed a
List<Map<String, Object>> with a row for each changed object and a map with
attribute/relationship key to the new value. Looking at
NodePropertyChangeOperation - it has the key and the old and new value, but
the API doesn't have any way of extracting that information that I see.

Most likely I just don't understand how to use this correctly, but I'm
guessing I wouldn't be the only one.

On Fri, Oct 11, 2019 at 5:36 AM Andrus Adamchik <[email protected]>
wrote:

> Was just answering Cayenne change tracking question on StackOverlow [1],
> and realized that the only user-friendly API that allows to check for
> individual changes is "cayenne-commitlog" that only works during commit.
> All the pre-commit APIs are internal and require lots of hoop jumping. I
> think we can address that on the cheap in 4.2 by defining a method like
> this in GraphManager.java:
>
>   GraphDiff getChanges();
>
> We already have such method implemented in ObjectStore, so there's really
> no effort and an immediate benefit. Or take it a step further and
> additionally implement filtering changes per object:
>
>   GraphDiff getChanges(Persistent)
>
> Thoughts?
>
> Andrus
>
> [1]
> https://stackoverflow.com/questions/58318730/what-is-the-current-best-method-of-getting-the-changes-to-an-object-hierarchy-in
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.