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] Created: (OPENJPA-74) Trying to create a named query that is defined in an orm.xml file causes a NullPointerException
Date Thu, 02 Nov 2006 02:48:17 GMT
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