You'll have to do something like the following: - Iterate over the new contact methods and persist them. - Retrieve the Person object. - Iterate over the newly persisted contact methods and add their keys to the Person's list of contact methods
At the moment you're just trying to add objects to a filtered result set of random contact methods, which doesn't make much sense :) On Aug 26, 12:54 am, Shaun <shaunc...@gmail.com> wrote: > I have no idea how this doesn't seem to come up anywhere when I > search, but for some reason when I try to add an item to a List<Key> > that has been pulled out of the datastore I get this error: > > java.lang.UnsupportedOperationException: Query result sets are not > modifiable > at > org.datanucleus.store.query.AbstractQueryResult.add(AbstractQueryResult.java: > 221) > at > com.appointment.actions.ContactActions.updateContactMethods(ContactActions.java: > 1186) > > My code looks like this: > > public List<ContactMethod> updateContactMethods(List<ContactMethod> > pPassedContactMethods,List<Key> pDatastoreContactMethodKeys) { > .... > PersistenceManager pm = PMF.get().getPersistenceManager(); > Query query = pm.newQuery(ContactMethod.class); > query.setFilter("key == :keyList"); > query.execute(pDatastoreContactMethodKeys); > List<ContactMethod> pDataStoreContactMethods = (List<ContactMethod>) > pm.newQuery(query).execute(pDatastoreContactMethodKeys); > .... > for (ContactMethod lContactMethod : pPassedContactMethods) { > pDataStoreContactMethods.add(lContactMethod);} > > pm.close(); > return pDataStoreContactMethods; > > } > > The goal is that when someone adds a new ContactMethod the system > picks that up and adds it to the set of Keys reference in that > Person's List<Key> contactsmethods to allow the managing of an unowned > relationship. > > Thanks ahead of time for any help! -- 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.