Test app to reproduce: http://ancestortest.latest.duh-test.appspot.com/
Source code: http://ancestortest.latest.duh-test.appspot.com/src/ancestortest/AncestorTestServlet.java http://ancestortest.latest.duh-test.appspot.com/src/ancestortest/UserAccount.java http://ancestortest.latest.duh-test.appspot.com/src/ancestortest/UserAccountModification.java This sample code basically creates two UserAccount objects and attaches a UserAccountModification to one of them. Then, a query (which, unless the datastore is really slow, should return an empty list): ===== Query q = em.createQuery("select m from UserAccountModification m where m.modTime < :newest and m.owner = :owner order by modTime desc"); q.setParameter("newest", System.currentTimeMillis() - 10000L); q.setParameter("owner", user1); List<UserAccountModification> mods = q.getResultList(); ===== I get the following exception: javax.persistence.PersistenceException: SELECT FROM UserAccountModification m WHERE m.modTime < :newest and m.owner = :owner ORDER BY modTime desc: Key of parameter value does not have a parent. at org.datanucleus.jpa.NucleusJPAHelper.getJPAExceptionForNucleusException (NucleusJPAHelper.java:264) at org.datanucleus.jpa.JPAQuery.getResultList(JPAQuery.java:179) at ancestortest.AncestorTestServlet.doGet(AncestorTestServlet.java: 46) I must be missing something here. The docs for GAE talk about ensuring the use of ancestor filters when inside a transaction, for instance, and there's the ANCESTOR IS operator in GQL. However, I can't seem to figure out how properly to express this in JPQL (as "ANCESTOR IS" is a syntax error there), and there's no docs that I can find on doing this in JPA. The query is meant to find UserAccountModification objects all residing under a given "owner", which happens to be the ancestor of those objects. Is there a proper expression for this using JPQL? -- 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=.