]
Gail Badner commented on HHH-2978:
----------------------------------
Please attach all test case files, including a Java class that reproduces the issue, in
compressed tar file.
Using HQL index() on a <index-many-to-many..> key in a
<map...> cannot dereference any properties of the key -
java.lang.NullPointerException
---------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-2978
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2978
Project: Hibernate3
Issue Type: Bug
Components: query-hql
Affects Versions: 3.2.5
Environment: Hibernate 3.2.5 GA, MySQL 5.0.27 Community NT, Eclipse 3.1.1,
Hibernate Tools 3.2 beta 9
Reporter: James Andrews
As mentioned in summary, using a mapped POJO as the index of a <map..>
relationship, via the <index-many-to-many class="..> approach.
Using a table join, for instance:
select index(depts), depts
from ModificationFixed fixed
left join fixed.departments depts
Will fetch Department instances for each value, but if you instead try to fetch a
property of the index:
select index(depts).name, depts
from ModificationFixed fixed
left join fixed.departments depts
then this causes the aforementioned NullPointerException, both in the hibernate tools
preview, and in practise when trying to execute the query, with the following stack
trace:
Exception in thread "main" java.lang.NullPointerException
at org.hibernate.hql.ast.HqlSqlWalker.lookupProperty(HqlSqlWalker.java:444)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.propertyRef(HqlSqlBaseWalker.java:1080)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:1881)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:1825)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1394)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:553)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:115)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at intranet.db.PersistentMySQL.createQueryArray(PersistentMySQL.java:154)
at intranet.budget.planner.ModificationFixed.main(ModificationFixed.java:165)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: