NullPointerException while building SessionFactory when using native sql query for loading
many-to-many mapped collections
--------------------------------------------------------------------------------------------------------------------------
Key: HHH-3128
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3128
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.6, 3.2.5
Environment: Hibernate 3.2.6
Reporter: Juergen Denzel
Attachments: src.zip
Hi,
I am trying to load a many-to-many mapped collection using a sql query like this:
<sql-query name="loadItems">
<load-collection alias="item" role="test.Test.items"/>
select {item.*} from Items item where item.id = :id
</sql-query>
This always fails due to a NullPointerException:
java.lang.NullPointerException
at
org.hibernate.loader.custom.sql.SQLQueryParser.resolveProperties(SQLQueryParser.java:182)
at
org.hibernate.loader.custom.sql.SQLQueryParser.resolveCollectionProperties(SQLQueryParser.java:135)
at
org.hibernate.loader.custom.sql.SQLQueryParser.substituteBrackets(SQLQueryParser.java:98)
at org.hibernate.loader.custom.sql.SQLQueryParser.process(SQLQueryParser.java:51)
at org.hibernate.loader.custom.sql.SQLCustomQuery.<init>(SQLCustomQuery.java:110)
at
org.hibernate.engine.query.NativeSQLQueryPlan.<init>(NativeSQLQueryPlan.java:43)
at
org.hibernate.engine.query.QueryPlanCache.getNativeSQLQueryPlan(QueryPlanCache.java:114)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:446)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:352)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
at test.HibernateTest.testSessionFactory(HibernateTest.java:18)
I provided a very simple TestCase + Mappings to illustrate the problem. The exception does
not occur for one-to-many mappings.
Just for your information, we need this functionality in order to deal with DB2 problems
we have.
I ran this TestCase against 3.2.5 and 3.2.6 and both failed.
Thanks.
Juergen Denzel
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira