Try : Key k = KeyFactory.createKey(User.class.getSimpleName(), Key.getId());
Instead of : Key k = KeyFactory.createKey(User.class.getSimpleName(), Long.parseLong(Key)); On 30/09/10 01:16, "hendrix.jason" <hendrix.ja...@gmail.com> wrote: >What could this error mean: > >java.lang.ClassCastException: >[Lcom.google.appengine.api.datastore.Key; cannot be cast to >com.google.appengine.api.datastore.Key > >It's happening on the last line of this code: > >PersistenceManager pm2 = PMF.get().getPersistenceManager(); > Key k = >KeyFactory.createKey(User.class.getSimpleName(),Long.parseLong(Key)); > User u = pm2.getObjectById(User.class, k); > > Long[] group_array = u.getGroups(); > Key[] group_keys = new Key[group_array.length]; > int c = 0; > while(c < group_array.length){ > group_keys[c] = >KeyFactory.createKey(Group.class.getSimpleName(), >group_array[c]); > c++; > } > > javax.jdo.Query q = >pm2.newQuery(Group.class,"key.contains(:key)"); > List<Group> groups = (List<Group>) q.execute(group_keys); > >-- >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. > -- 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.