Hi Shawn, My apologies, but the Extent example on the page you referenced is not supported because we have no way to efficiently query across different types (datastore queries are either by kind, by ancestor, or both).
pm.getObjectById(TestDN.class, key) will fail if the persistent type of the entity referenced by key is not TestDN.class. If they key you're passing identifies a TestDN.TestSubDN instance then the failure is expected. Thanks, Max On Mon, Dec 7, 2009 at 12:40 AM, Shawn Brown <[email protected]>wrote: > > You can find information on using inheritance in JDO here: > > > http://www.datanucleus.org/products/accessplatform_1_1/jdo/orm/inheritance.html > > Note that app engine _only_ supports the 4th option, "complete-table." > > According to that link, this should work to query subclasses: > > tx.begin(); > Extent e = pm.getExtent(com.mydomain.samples.store.Product.class, true); > Query q = pm.newQuery(e); > Collection c=(Collection)q.execute(); > tx.commit(); > > Is this supported or not. I can't get it to work using > > @PersistenceCapable(identityType = IdentityType.APPLICATION) > @Inheritance(customStrategy = "complete-table") > public abstract class TestDN { > > ... > > @PersistenceCapable(identityType = IdentityType.APPLICATION) > public static class TestSubDN extends TestDN { > ... > } > } > > > It's persisting fine and I can retrieve it if I use for example > pm.getObjectById(TestDN.TestSubDN.class, key); > > pm.getObjectById(TestDN.class, key); fails though. > > this is under 1.2.8 > > Shawn > > -- > > 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]<google-appengine-java%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > > -- 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.
