java.lang.UnsupportedOperationException: This operation is not supported on Query Results at org.datanucleus.store.query.AbstractQueryResult.contains(AbstractQueryResult.java:250) at java.util.AbstractCollection.retainAll(AbstractCollection.java:369) at namespace.MyServlet.doGet(MyServlet.java:101)
I am trying to take one list that I extracted from a data warehouse query and save only those results that are also in the list that I got from the list of keys. Both of my lists are populated as expected, but I apparently can't save UserAll on any of them.
// List<Data> listOne = new ArrayList(query.execute(theQuery)); // DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); // List<Data> listTwo = new ArrayList(ds.get(keys).values()); // listOne.retainAll(listTwo);
EDIT
Well, in an attempt to simplify, as this seems to have several problems in one, I stopped using the low-level API for data storage and instead of just pulling one after the other with a loop.
List<MyClass> test = (List<MyClass>) query.execute(); List<MyClass> test2 = new ArrayList<MyClass>(); for (String key : favorites) { test2.add(pm.getObjectById(MyClass.class, key)); } log.info(test.toString()); test.retainAll(test2);
The above work. This is no exception. The following is an exception. The only difference is log.info. I'm at a dead end.
List<MyClass> test = (List<MyClass>) query.execute(); List<MyClass> test2 = new ArrayList<MyClass>(); for (String key : favorites) { test2.add(pm.getObjectById(MyClass.class, key)); } test.retainAll(test2);
Joren source share