Objectify author here.

I would not bother with the @PrePut/@PostPut callbacks; I have yet to find
a case where they are actually useful. Instead wrap the low level
AsyncDatastoreService and build your code as an interceptor/decorator. That
way you have full control.

One example is the CachingAsyncDatastoreService in Objectify, another is
this: https://github.com/objectify/objectify-insight

Jeff

On Tue, Jun 2, 2015 at 3:49 AM, Nejc Tomažič <[email protected]> wrote:

>
> Hi guys,
>
> as already described on StackOverflow:
>
> I'm working on entity auditing for a set of entities saved in GAE
> Datastore using @PrePut and @PostPut datastore callbacks.
>
> Idea is that old entity is loaded in @PrePut using Objectify and stored to
> context. Than updated entity is added to context in @PostPut callback. When
> request is processed I generate a diff in ContainerResponseFilter and save
> it.
>
> Issue: if entity is updated non transactional, entity retrieved from
> datastore in @PrePut callback is already updated and therefore I'm unable
> to get a diff.
> Is this a bug or it is supposed to work like that (if this is a  case I
> would highly recommend adding a note to the docs here:
> https://cloud.google.com/appengine/docs/java/datastore/callbacks)
>
> Question: Is it possible to retrieve old entity in @PrePut datastore
> callback if save operation is non transactional? If not, what would be the
> best alternative?
>
> All load and save operations are made using Objectify. Versions:
> Objectify: 5.1.5 Appengine version: 1.9.20
>
> Question on SO:
> http://stackoverflow.com/questions/30591289/get-old-entity-in-preput-datastore-callback-for-non-transactional-update
>
> I would really appreciate help on this one.
> Thanks,
> KR, Nejc
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/google-appengine.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-appengine/ced9eca8-d836-42d8-be71-02b41769d8f6%40googlegroups.com
> <https://groups.google.com/d/msgid/google-appengine/ced9eca8-d836-42d8-be71-02b41769d8f6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/CADK-0ujsoRjp0DEERaYAjnanaC_zvYfugrAddGK-gXaCR_nQng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to