Google Groups

Re: [appengine-java] Jdo behavior discrepancy between development server and real server

Max Ross May 14, 2009 2:04 PM
Posted in group: Google App Engine for Java
Very perceptive observation.  The behavior you're reporting is due to the fact that, right now, the local datastore isn't really transactional.  Specifically, changes to attached objects become visible as soon as those updates are flushed rather than once the transaction commits.  Your call to getObjectById is causing your change to b to be flushed to the datastore and that change is then visible when you read the list of B's that a owns.  In production, the update to b isn't visible until after the transaction commits.

We have a rough plan to implement transactions in the local datastore in a way that more closely resembles prod, but feel free to file an issue so that you can get notified when we take care of it.


On Thu, May 14, 2009 at 2:26 AM, J Robert Ray <> wrote:

I have a model A that contains a list of child entities B. It is an
owned relationship and they are in the same entity group.

Some pseudo code like this:

do_in_transaction {
   // get a B by key
   B b = getObjectById(B, b_key);

   // change b

   // get the A that contains B
   A a = getObjectById(A, b.getAKey());

   // get the list of Bs from a
   List<B> bs = a.getBs();

   // loop over the Bs
   for (B b2 : bs) {
       // discrepancy here
       b2.getFoo() == ?

On the development server, b2.getFoo() will return the new value as
set earlier in the transaction.

On the app engine, b2.getFoo() will return the old value from before
the transaction. The new value does get stored though, no problem

The B List is defined like so:

   @Element(dependent = "true")
   @Order(extensions = @Extension(
       vendorName = "datanucleus", key = "list-ordering",
       value = "signupTime asc, actualSignupTime asc, character asc"
   private List<Signup> signups = new ArrayList<Signup>();

This is on 1.2.1 but this behavior is not new to 1.2.1.