DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
Issue Details (XML | Word | Printable)

Key: NUCCORE-700
Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Priority: Major Major
Assignee: Unassigned
Reporter: Guido Anzuoni
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Core

Query result not closed if single result taken

Created: 20/Apr/11 07:53 PM   Updated: 09/May/11 09:58 AM   Resolved: 21/Apr/11 08:12 AM
Component/s: None
Affects Version/s: None
Fix Version/s: None


 Description  « Hide
The close() methog in org.datanucleus.store.query.Query


    public void close(Object queryResult)
    {
        if (queryResult != null && queryResult instanceof QueryResult && queryResults != null)
        {
            // important to remove result first before closing it, as its hashCode() may
            // change after closing so the queryResults HashSet won't find it anymore and
            // consequently won't remove it (see AbstractQueryResult.hashCode())
            queryResults.remove(queryResult);
            ((QueryResult)queryResult).close();
        }
    }

does not close se query result in JPA case because queryResults member is null in that case

the method should become:
    public void close(Object queryResult)
    {
        if (queryResult != null && queryResult instanceof QueryResult)
        {
            // important to remove result first before closing it, as its hashCode() may
            // change after closing so the queryResults HashSet won't find it anymore and
            // consequently won't remove it (see AbstractQueryResult.hashCode())
            if (queryResults != null)
            {
                queryResults.remove(queryResult);
            }
            ((QueryResult)queryResult).close();
        }
    }