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] Resolved: (OPENJPA-74) Trying to create a named query that is defined in an orm.xml file causes a NullPointerException
Date Fri, 03 Nov 2006 21:12:17 GMT
     [ http://issues.apache.org/jira/browse/OPENJPA-74?page=all ]

Marc Prud'hommeaux resolved OPENJPA-74.
---------------------------------------

    Resolution: Fixed

Fixed multiple problems with named queries: 

1. They were not being parsed as part of the or m.xml file, since we were incorrectly looking
for an attribute named 'query' (when it really should have been a sub-element named 'query').


2. Looking for a named query did not force resolution of all metadatas.

3. An NPE was being thrown when a JPQL query was created with a null filter

> Trying to create a named query that is defined in an orm.xml file causes a NullPointerException
> -----------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-74
>                 URL: http://issues.apache.org/jira/browse/OPENJPA-74
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>            Reporter: Marc Prud'hommeaux
>         Assigned To: Marc Prud'hommeaux
>            Priority: Minor
>
> When declaring a <named-query> element in the orm.xml and trying to create that
query with "EntityManager.createNamedQuery", a NullPointerException is always thrown:
> Caused by: java.lang.NullPointerException
>        at java.io.StringReader.<init>(StringReader.java:33)
>        at org.apache.openjpa.kernel.jpql.JPQL.<init>(JPQL.java:17)
>        at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.parse(JPQLExpressionBuilder.java:1638)
>        at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.<init>(JPQLExpressionBuilder.java:1628)
>        at org.apache.openjpa.kernel.jpql.JPQLParser.parse(JPQLParser.java:44)
>        at org.apache.openjpa.kernel.ExpressionStoreQuery.newCompilation(ExpressionStoreQuery.java:141)
>        at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:594)
> This is because XMLPersistenceMetaDataParser.startNamedQuery() is checking for the "query"
attribute of the "named-query" element for the query string, as was defined in a pre-release
version of the JPA spec. Subsequent versions changed this to be a "query" sub-element rather
than an attribute, and we never updated our parser (and the TCK never tests for it).
> Note that this only affects named queries as defined in orm.xml files. Named queries
defined via @NamedQuery annotations don't suffer from this problem.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message