openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fernando (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-787) slices query.getSingleResult is broken
Date Wed, 26 Nov 2008 22:34:44 GMT

    [ 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.


Mime
View raw message