This might be very obvious, but imagine you have an object in the
datastore that you simply want to to replace with another, i.e. keep
the same key, just replace all the field values. Is there any easy way
to do this without setting each field value of the datastore object
with field values of the other object?
As an example I find myself doing this alot:
ExpenseEntry lJsonExpenseEntry = gson.fromJson(pExpenseEntryJson,
ExpenseEntry.class);
ExpenseEntry lExpenseEntry =
pm.getObjectById(ExpenseEntry.class,
expenseKey);
lExpenseEntry.setExpenseamount(lJsonExpenseEntry.getExpenseamount());
lExpenseEntry.setExpensecategory(lJsonExpenseEntry.getExpensecategory());
lExpenseEntry.setExpensedate(lJsonExpenseEntry.getExpensedate());
lExpenseEntry.setExpensename(lJsonExpenseEntry.getExpensename());
lExpenseEntry.setExpensenotes(lJsonExpenseEntry.getExpensenotes());
lExpenseEntry.setExpenseuser(lJsonExpenseEntry.getExpenseuser());
lExpenseEntry.setProjectid(lJsonExpenseEntry.getProjectid());
in order to update the datastore object, ideally I could do this all
in a few lines by simply replacing the current datastore object with
the new one. Maybe just removepersistence and then add it again?
Thanks for the thoughts.
Shaun
--
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.