FYI... This issue was resolved by changing the last line from this: List<Group> groups = (List<Group>) q.execute(group_keys);
to this: List<Group> groups = (List<Group>) q.execute(Arrays.asList(group_keys)); Thanks, Jason On Oct 2, 5:55 pm, "hendrix.jason" <hendrix.ja...@gmail.com> wrote: > group_keys is an array containing several "Key" values. I want to > perform a query that returns all "Group" items that have a key value > that exists in the array "group_keys". > > On Oct 2, 5:24 pm, Cyrille Vincey <crll...@gmail.com> wrote: > > > > > > > > > As far as I know, the execute() method does not work with arrays arguments. > > Modify the declaration of your 'group_keys' from 'Key[]' to 'Key'. > > By the way, all query errors happen to be assigned to the 'execute' line in > > debug mode. > > > Le 2 oct. 2010 à 19:41, "hendrix.jason" <hendrix.ja...@gmail.com> a écrit : > > > > Cryille, > > > > Using debug mode, I can see that the group_keys array is being > > > populated correctly. > > > > The error is appearing on the last line: > > > List<Group> groups = (List<Group>) q.execute(group_keys); > > > > Thanks, > > > Jason > > > > On Sep 30, 3:41 am, Cyrille Vincey <crll...@gmail.com> wrote: > > >> 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 > > > athttp://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.