DescriptionIf we have
Query q = pm.newQuery(myQuery);
List<Candidate> results = (List<Candidate>)q.execute();
pm.close();
then accessing of the results after close results in
org.datanucleus.exceptions.NucleusUserException: Object Manager has been
closed
at org.datanucleus.ObjectManagerImpl.assertIsOpen
(ObjectManagerImpl.java:3876)
at org.datanucleus.ObjectManagerImpl.getFetchPlan
(ObjectManagerImpl.java:376)
at org.datanucleus.store.query.Query.getFetchPlan(Query.java:497)
at org.datanucleus.store.appengine.query.DatastoreQuery$5.apply
(DatastoreQuery.java:508)
at org.datanucleus.store.appengine.query.DatastoreQuery$5.apply
(DatastoreQuery.java:507)
at
org.datanucleus.store.appengine.query.StreamingQueryResult.resolveNext
(StreamingQueryResult.java:137)
See Issue 151 for one example, but its been a common issue during the last 2 yrs of GAE/J. This is because the query knows nothing about the close of the connection that it uses. the provided patch registers a listener for connection closure (and txn commit), meaning that the QueryResult.disconnect() method is called when this happens giving the QueryResult chance to load up all remaining results.
Patch Set 1 #
MessagesTotal messages: 4
|