You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Fernando (JIRA)" <ji...@apache.org> on 2008/11/26 23:34:44 UTC

[jira] Commented: (OPENJPA-787) slices query.getSingleResult is broken

    [ https://issues.apache.org/jira/browse/OPENJPA-787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651167#action_12651167 ] 

Fernando commented on OPENJPA-787:
----------------------------------

very simple patch.  should fix this issue.


--- openjpa-slice/src/main/java/org/apache/openjpa/slice/jdbc/DistributedStoreQuery.java        (revision 721000)
+++ openjpa-slice/src/main/java/org/apache/openjpa/slice/jdbc/DistributedStoreQuery.java        (working copy)
@@ -147,10 +147,10 @@
                }
                boolean[] ascending = getAscending(q);
                boolean isAscending = ascending.length > 0;
-               boolean isUnique    = q.getContext().isUnique();
+               boolean isAggregate = q.getContext().isAggregate();
                boolean hasRange    = q.getContext().getEndRange() != Long.MAX_VALUE;
                ResultObjectProvider result = null;
-               if (isUnique) {
+               if (isAggregate) {
                    result = new UniqueResultObjectProvider(tmp, q, 
                            getQueryExpressions());
                } else if (isAscending) {




But though it looks like it's working better.  Now I'm hitting another bug, that it looks like somehow the old EnityManager/Broker is being reused across requests.  I know this because it works fine for first request, but second request complains that the Broker is already closed.  So I might be opening up a new bug for that.

> slices query.getSingleResult is broken
> --------------------------------------
>
>                 Key: OPENJPA-787
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-787
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.0.0
>            Reporter: Fernando
>            Priority: Critical
>
> Pinaki Poddar wrote:
> >   Query.getSingleResult() is badly broken (or, more precisely non-existent). 
> >   Currently, use the workaround for Query.getSingleResult() i.e.
> >     Query.getResultList().get(0) 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.