openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc Prud'hommeaux (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-208) NoResultException and NonUniqueResultException are not thrown when expected
Date Fri, 06 Apr 2007 22:33:32 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12487348
] 

Marc Prud'hommeaux commented on OPENJPA-208:
--------------------------------------------

This seems to have slipped in in the fix for OPENJPA-168: see http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java?p2=%2Fincubator%2Fopenjpa%2Ftrunk%2Fopenjpa-persistence%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fopenjpa%2Fpersistence%2FQueryImpl.java&p1=%2Fincubator%2Fopenjpa%2Ftrunk%2Fopenjpa-persistence%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fopenjpa%2Fpersistence%2FQueryImpl.java&r1=522581&r2=522580&view=diff&pathrev=522581


> NoResultException and NonUniqueResultException are not thrown when expected
> ---------------------------------------------------------------------------
>
>                 Key: OPENJPA-208
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-208
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 0.9.6
>            Reporter: Marc Prud'hommeaux
>         Assigned To: Marc Prud'hommeaux
>
> When calling Query.getSingleResult() on a query that either has no result or multiple
results, either a NoResultException and NonUniqueResultException (respectively) should be
thrown in accordance with section 3.6.1 of the JPA spec. Instead, we appear to throw a org.apache.openjpa.persistence.InvalidStateException:
> org.apache.openjpa.persistence.InvalidStateException: The query on candidate type "class
com.sun.ts.tests.ejb30.persistence.query.apitests.Department" with filter "select d.name from
Department d where d.id > 1" was configured to have a unique result, but more than one
instance matched the query.
>      at org.apache.openjpa.kernel.QueryImpl.singleResult(QueryImpl.java:1282)
>      at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1207)
>      at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:982)
>      at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:791)
>      at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:761)
>      at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:757)
>      at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:514)
>      at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:225)
>      at org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:287)

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