
| Key: |
HHH-2264
|
| Type: |
Bug
|
| Status: |
Resolved
|
| Resolution: |
Fixed
|
| Priority: |
Minor
|
| Assignee: |
Unassigned
|
| Reporter: |
Rüdiger Schulz
|
| Votes: |
0
|
| Watchers: |
0
|
|
If you were logged in you would be able to see more operations.
|
|
|
|
Environment:
|
JDK 1.5.0_09-b03, JBoss 4.0.5 GA, MySQL 5.0.24a, mysql-connector-java-5.0.4
|
|
|
I just got a weird NullPointerException using Hibernate JPA. When creating my EntityManagerFactory, the usual logging started to appear and finished in stacktrace containing this:
Exception in thread "main" java.lang.NullPointerException
at org.hibernate.hql.ast.ParameterTranslationsImpl.getNamedParameterExpectedType(ParameterTranslationsImpl.java:63)
at org.hibernate.engine.query.HQLQueryPlan.buildParameterMetadata(HQLQueryPlan.java:296)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:97)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:400)
at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:351)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:691)
I could root it down to a NamedQuery in one of my Entites; when commenting it out, the creation went through fine. The Query definition looked like this:
@NamedQuery(
name = "User.find",
query = "SELECT user FROM User user WHERE user.id =: id"
)
After some googling I found a solution on the Spring forum: it's the whitespace between the colon and the variable name. The error message should be more specific here, or better yet, the whitespace should not throw an error.
|
|
Description
|
I just got a weird NullPointerException using Hibernate JPA. When creating my EntityManagerFactory, the usual logging started to appear and finished in stacktrace containing this:
Exception in thread "main" java.lang.NullPointerException
at org.hibernate.hql.ast.ParameterTranslationsImpl.getNamedParameterExpectedType(ParameterTranslationsImpl.java:63)
at org.hibernate.engine.query.HQLQueryPlan.buildParameterMetadata(HQLQueryPlan.java:296)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:97)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:400)
at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:351)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:691)
I could root it down to a NamedQuery in one of my Entites; when commenting it out, the creation went through fine. The Query definition looked like this:
@NamedQuery(
name = "User.find",
query = "SELECT user FROM User user WHERE user.id =: id"
)
After some googling I found a solution on the Spring forum: it's the whitespace between the colon and the variable name. The error message should be more specific here, or better yet, the whitespace should not throw an error. |
Show » |
| There are no comments yet on this issue.
|
|