openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Laird Nelson (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OPENJPA-2065) JPA 2.0 Spec. Violation? EntityManager#createNamedQuery(String, Class) bombs with non-entity Class parameter
Date Wed, 26 Oct 2011 19:33:32 GMT

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

Laird Nelson commented on OPENJPA-2065:
---------------------------------------

That would imply among other things that this too is illegal:

final TypedQuery<Long> q = em.createNamedQuery("someQueryThatReturnsAnAggregateOrCOUNTResult",
Long.class);

And this:

final TypedQuery<Object[]> q = em.createNamedQuery("someQueryThatReturnsAnObjectArrayBecauseOfStuffInTheSelectClause",
Object[].class);

Is that really the case?  Section 2.11 has very narrow scope.  2.11.3 would seem to have been
conceived of within the bounds of that scope, not within the bounds of the entire specification.
 Nevertheless, there it is.  That is really unfortunate.  I'll ask the sleepy users@jpa-spec.java.net
list, where I appear to be the only poster, what they think.
                
> JPA 2.0 Spec. Violation? EntityManager#createNamedQuery(String, Class) bombs with non-entity
Class parameter
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2065
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2065
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 2.1.0, 2.1.1
>            Reporter: Laird Nelson
>              Labels: specification
>
> Suppose we have an interface, A.
> Suppose we have a JPA-compliant entity class, B, that implements A.
> This construction will fail at runtime:
> final TypedQuery<A> q = em.createNamedQuery("someNamedQuery", A.class);
> Hibernate and EclipseLink both accept this construction.
> I don't see anywhere in the JPA specification that the class parameter must denote an
entity type.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message