Hi,

I am new to both GAE and JDO. I would be grateful if someone could provide 
guidance on a behavior I find rather counter-intuitive. In the following 
code, I have to call pm.evictAll() to successfully/persistently change 
properties (labels) on a freshly persisted object (bookmark):

PersistenceManager pm = PMF.get().getPersistenceManager();
try {
Bookmark bookmark = new Bookmark(url);
bookmark = pm.makePersistent(bookmark);
pm.evictAll();
Key k = bookmark.getKey();
bookmark = pm.getObjectById(Bookmark.class, k);
bookmark.addLabels(labels);
} finally {
pm.close();
}

I'd naively expect the above code to persistently adding labels to 
bookmarkseven without calling 
pm.evictAll()and with explicitly (re-)fetching the bookmark object. I'd 
expect JDO to "notice" that the Bookmark instance has been "dirtied" and 
pm.close() to persist the changes to the cached object.

I find it also counter-intuitive that pm.evict(bookmark) doesn't work -- 
the entire cache needs to be cleared for new labels on bookmark to get 
persisted. (Even though pm.evict(Object) appears to expect a *
persistent-clean* object, which, in turn, appears to assume being in a 
transaction...)

Any pointers on the reasons of this behavior will be gratefully appreciated.

Peter

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/wF7hb8W2NsMJ.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to