yes, the real code below passes the class as part of the getObjectById(), but the JDO lookup thinks that I'm trying to fetch a different Kind just because the first characters in the string id are for another Kind. So the call fails when using the id value: "agxjYW1sb2d2aWV3ZXJyDwsSB0FwcFVzZXIYybgDDA counter1 2011-07-07" but works fine with a slight rearrangement of the string elements with the id value: "counter1 agxjYW1sb2d2aWV3ZXJyDwsSB0FwcFVzZXIYybgDDA 2011-07-07"
public T get(String id) throws DaoException { PersistenceManager pm = pmf.getPersistenceManager(); try { return pm.detachCopy(pm.getObjectById(Counter.class, id)); } catch (JDOObjectNotFoundException jonfe) { return null; } catch (Exception e) { log.log(Level.SEVERE, e.getMessage(), e); throw new DaoException(e); } finally { pm.close(); } } the key name is like this: @Persistent @Extension(vendorName="datanucleus", key="gae.pk-name", value="true") private String counter; On Thu, Jul 7, 2011 at 11:07 AM, Stephen Johnson <onepagewo...@gmail.com>wrote: > I'd suggest posting some real code for us to help you make a determination. > > On Thu, Jul 7, 2011 at 11:03 AM, Stephen Johnson <onepagewo...@gmail.com> > wrote: > > Have you tried using the two parameter getObjectById that takes the > > JDO entity class type as the first parameter which I would presume > > (but not verified) then doesn't need to inspect the supplied string to > > determine the entity kind? > > > > On Thu, Jul 7, 2011 at 10:38 AM, Carter <jcmas...@gmail.com> wrote: > >> This problem is specific to Java JDO implementation. > >> Do you agree that this should be filed as a bug? (i.e. key names > >> should be opaque strings rather than interpreted by JDO to determine > >> entity kind?) > >> > >> getObjectById() is using only the first part of the supplied keyString > >> as the *whole* key in determining the Kind being retrieved. > >> We had expected it to use the entire keyString - without interpreting > >> the fact that the first part of the key name contains the keyString of > >> another Kind of Entity. > >> > >> As background, we're using the keyString of one Kind (say, "Bean") as > >> *part* of the key name for another Kind (say, "Counter"). > >> When using getObjectById(keyString counterName dateString), we get an > >> exception since the first part of the key name is the keyString of > >> another Kind. > >> But when using getObjectById(counterName keyString dateString), we're > >> fine. > >> So simply switching the order of the elements of the key name string > >> is a workaround for this bug that produces this Exception (edited for > >> clarity): > >> > >> Caused by: javax.jdo.JDOFatalUserException: Exception converting > >> agxjYW1sb2d2aWV3ZXJyDwsSB0FwcFVzZXIYybgDDA counter1 2011-07-07 to an > >> internal key. > >> NestedThrowables: > >> org.datanucleus.store.appengine.FatalNucleusUserException: Received a > >> request to find an object of kind Counter but the provided identifier > >> is the String representation of a Key for kind Bean > >> at > >> > org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManager.getObjectById(DatastoreJDOPersistenceManager.java: > >> 68) > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups "Google App Engine" group. > >> To post to this group, send email to google-appengine@googlegroups.com. > >> To unsubscribe from this group, send email to > google-appengine+unsubscr...@googlegroups.com. > >> For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > >> > >> > > > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to google-appengine@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.