Hi Tim,

Ithink you ran into the same problem as me. You can see in my post
(http://groups.google.com/group/google-appengine-java/browse_thread/
thread/a0be8114353d9798/c3b9e94f1942d661?lnk=gst&q=entity+updated
+twice#c3b9e94f1942d661) an example where I just call make persistence
once on an entity, but JDO seems to consider that it is updated twice.

It seems that there is a kind of problem when you create a hierarchy
of objects when the parents are detached (it works perfect is
everything is created at once).
One of the way to solve that problem for me was to set
datanucleus.attachPolicy to "attach-dirty" (which is the default
value) instead of "attach-all". I think high level persistence
frameworks are still not mature in Appengine.

But if you want to be able to persist entities without modifying any
of their field (which was my case as I was trying to save entities in
memory and roll them back "by hand" if a set of commit operation
failed), then you are stuck...


Hope that helps.

On 6 déc, 11:00, Tim Cooper <[email protected]> wrote:
> Thanks Peter for your reply.
>
> In fact, after doing some experimentation, I'm able to answer most of
> my own questions, at least unless a Google engineer corrects my
> answers:
>
> * What is an "update" exactly?  Is it a call to "pm.makePersistent
> ()"?  Is it a call to "tx.commit()"?  Is it a call to "pm.flush()"?
> Is it an update of a single field in a single Java object?  Is it an
> invocation of "doGet()/doPost()"?
>
> tim> If you're not using transactions, then an update seems to mean a
> call to "pm.makePersistent()", (or "pm.makePersistentAll()" on objects
> within anentitygroup.)  If you are using transactions, the answer
> seems more complicated and I don't know.
>
> * Suppose you want to do multiple updates within the oneentitygroup
> within a single Java function.  At what point is the 100ms cost
> incurred?   Which function call blocks for the 100ms?
> tim> If you're not using transactions, then it's "pm.makePersistent()"
> which blocks.  If you are using transactions, then I *think* there's
> significant time elapsed in both "pm.makePersistent()" and "tx.commit
> ()".
>
> * Is it possible to create 900 child entities in anentitygroup in a
> single Java function call, by structuring this "creation of 900
> objects" as a single "update"?
> tim> Yes, if I use "pm.makePersistentAll()"   (duh!).   I got my
> request running extremely quickly, (as quickly as I'd ever expect) by
> using "pm.makePersistentAll()".   I passed in a collection:
> "ArrayList<Object>".    I used an ArrayList<Object> in order that I
> can persist child objects if different types, and also even the head
> object, in a single call.
>
> * If I don't use transactions, does this "1-10 updates per second"
> limitation go away?
> tim> No.   The critical difference is the use of "pm.makePersistentAll
> ()".   (However, for the record:  it seems that transactions can
> somewhat mitigate the mistake of using "pm.makePersistent()" when you
> should be using "pm.makePersistentAll()":  for me, it made things runtwiceas 
> quick).

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.


Reply via email to