openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc Prud'hommeaux (JIRA)" <>
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
     [ ]

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:
>             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<init>(
>        at org.apache.openjpa.kernel.jpql.JPQL.<init>(
>        at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.parse(
>        at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.<init>(
>        at org.apache.openjpa.kernel.jpql.JPQLParser.parse(
>        at org.apache.openjpa.kernel.ExpressionStoreQuery.newCompilation(
>        at org.apache.openjpa.kernel.QueryImpl.newCompilation(
> 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:
For more information on JIRA, see:


View raw message