I have two persistable classes: test.test1.Test and test.test2.Test, but I can't persist/query objects of these classes right. There is a simple example shows wrong behavior:
test.TestServlet.java: package test; import java.io.IOException; import javax.jdo.JDOHelper; import javax.jdo.PersistenceManager; import javax.jdo.PersistenceManagerFactory; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class TestServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { PersistenceManager pm = pmFactory.getPersistenceManager(); pm.makePersistent(new test.test1.Test("1", "test1")); pm.close(); pm = pmFactory.getPersistenceManager(); pm.makePersistent(new test.test2.Test("1", "test2")); pm.close(); pm = pmFactory.getPersistenceManager(); response.getWriter().println("RESULT: " + pm.getObjectById (test.test1.Test.class, "1")); pm.close(); } public static final PersistenceManagerFactory pmFactory = JDOHelper.getPersistenceManagerFactory("transactions-optional"); } test.test1.TestServlet.java and test.test2.TestServlet.java are the same except package name, so I missed it: import javax.jdo.annotations.*; @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Test { public Test(String id, String data) { this.id = id; this.data = data; } public String toString() { return getClass().getName() + ": id=" + id + " data=" + data; } @PrimaryKey private String id; @Persistent private String data; } Surprising result I got is following: RESULT: test.test1.Test: id=1 data=test2 Expected result: RESULT: test.test1.Test: id=1 data=test1
-- 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.