I am using Hibernate 3.2.5. I have two mapped classes:
MappedA MappedB
I have an un-mapped class that aggregates the two mapped classes:
public class Container { private MappedA a; private MappedB b;
public Container(MappedA a, MappedB b) { ...and so on...
I can run this HQL query just fine:
"select new Container(a, b) from MappedA a, MappedB b where a.field = b.field"
I want to do a left join and it is not working:
"select new Container(a, b) from MappedA a left join MappedB b where a.field = b.field"
I get this exception:
java.lang.NullPointerException at org.hibernate.util.ReflectHelper.getConstructor(ReflectHelper.java:172) at org.hibernate.hql.ast.tree.ConstructorNode.resolveConstructor(ConstructorNode.java:114) at org.hibernate.hql.ast.tree.ConstructorNode.prepare(ConstructorNode.java:88) at org.hibernate.hql.ast.HqlSqlWalker.processConstructor(HqlSqlWalker.java:840)
I looked in the ReflectHelper.getConstructor source and the types array being passes in has a length of 2 but the second entry is null. The code is not written to handle the null. It looks like the code is not properly determining the type of "b" in my HQL statement.
Has anyone tried a query like this before? Is my syntax bad or could this be a defect in the code. I need to upgrade to the latest version of Hibernate but taking a brief look at the code, there aren't a lot of changes in this area.
Ed
|