Hi all,
I'm quite new with GoogleAppEngine and JDO.
I would like to suddenly save my changes to a persistent object before
closing the PersistenceManager object. In this way I hope to reduce
the possibility to get a ConcurrentModification Exception, or at least
it would be far simpler to manage it, given that I can retry a number
of times to change an attribute and re-save the object. Is it
possible?
I mean, now I have this scenario:
*****************************************************************************
PersistenceManager pm = //get from factory
MyPersistedObject obj = queryToDB(pm, other_args);
obj.setXXX(...);
//other stuff that needs obj
//save to DB:
try {
pm.makePersistent(obj);
} finally {
pm.close(); //here I can get a ConcurrentModification exception, and
I cannot recall all the changes made in the method!!
}
*****************************************************************************
I would like to pass to this scenario:
*****************************************************************************
PersistenceManager pm = //get from factory
MyPersistedObject obj = null;
int i = 0;
while (i < MAX_RETRIES) {
obj = pm.getObjectByID(objKey);
obj.setXXX(...);
try {
obj.SAVE(); //here I try save the object!!
break;
} catch (Exception e) {
i++;
}
}
//other stuff that needs obj
//close PM:
pm.close(); //here I would not have any ConcurrentModification
exception,given that all the objects have been already saved...
*****************************************************************************
Is it possible to have such a SAVE() method that allows me to continue
to use the same PersistenceManager?
Far better should be the possibility to fetch the object with one
PersistenceManager and save it with another. In this way I may
retrieve my object from datastore with a factory method and create my
own SAVE() methods in my object classes. Is it applicable this pattern
to JDO and GoogleAppEngine or am I forced to use the same instance of
PersistenceManager both to fetch and save the data?
Thank you very much!
Bye
cghersi
--
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.