Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(717)

Issue 4702045: JDOQL : load results on connection close (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 9 months ago by datanucleus
Modified:
12 years, 9 months ago
Reviewers:
maxr
Base URL:
http://datanucleus-appengine.googlecode.com/svn/trunk/trunk/
Visibility:
Public.

Description

If 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+109 lines, -58 lines) Patch
src/com/google/appengine/datanucleus/query/DatastoreQuery.java View 4 chunks +31 lines, -39 lines 0 comments Download
src/com/google/appengine/datanucleus/query/JDOQLQuery.java View 3 chunks +38 lines, -4 lines 0 comments Download
src/com/google/appengine/datanucleus/query/JPQLQuery.java View 3 chunks +35 lines, -1 line 0 comments Download
src/com/google/appengine/datanucleus/query/StreamingQueryResult.java View 2 chunks +5 lines, -14 lines 0 comments Download

Messages

Total messages: 4
datanucleus
12 years, 9 months ago (2011-07-13 12:34:35 UTC) #1
maxr
Change looks good, but what's all the commented out code in JPQLQuery? Are you going ...
12 years, 9 months ago (2011-07-15 02:05:04 UTC) #2
datanucleus
Yes, that code in JPQLQuery is what will be needed *when the 2 failing tests ...
12 years, 9 months ago (2011-07-15 05:45:34 UTC) #3
maxr
12 years, 9 months ago (2011-07-15 06:02:33 UTC) #4
I understand, thanks for the explanation.

Go ahead and submit.

On Fri, Jul 15, 2011 at 3:45 PM, <andy_jefferson@yahoo.com> wrote:

> Yes, that code in JPQLQuery is what will be needed *when the 2 failing
> tests are understood*. Obviously I may have to pull refactor other
> things before then depending on what it shows up, and then finally
> enable that code
>
>
>
>
http://codereview.appspot.com/**4702045/<http://codereview.appspot.com/4702045/>
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b