Hi,

I am using SDK 1.3.6.
I noticed the following inconsistencies when using JDO. Consider the
following example:

@PersistenceCapable
public class A implements LoadCallback {
  @Persistent
  @PrimaryKey
  public String key;

  @Persistent
  public String payload;

  @NotPersistent
  public String derivedData = null;

  public A() {
  }

  @Override
  public void jdoPostLoad() {
    derivedData = key;
  }
};


@Test
  public void testLoadCallback() {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    A a = new A();
    a.key = "foo";
    pm.makePersistent(a);
    pm.close();

    pm = PMF.get().getPersistenceManager();
    A a2 = pm.getObjectById(A.class, "foo");
    assertEquals("foo", a2.derivedData);   //    ASSERT 1
    pm.close();

    pm = PMF.get().getPersistenceManager();
    Extent<A> extent = pm.getExtent(A.class, false);
    for (A a3 : extent) {
      assertEquals("foo", a3.derivedData);  //    ASSERT 2
    }
    pm.close();
}

1. When 'payload' field in A is missing then ASSERT 1 fails, i.e.
jdoPostLoad is not called for classes that have only key as their
persistent data member.
2. Another problem is that ASSERT 2 always fails (even if payload is
defined), i.e. jdoPostLoad  is not called when objects are loaded via
query/extent interface.

Why does it happen?

-- 
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 google-appengine-j...@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