Tuesday, March 3, 2009

Hibernate hql error with sets

Hibernate error

If anyone gets an error similar to this:

java.lang.NullPointerException
at org.hibernate.hql.ast.tree.DotNode.getColumns(DotNode.java:97)
at org.hibernate.hql.ast.tree.DotNode.initText(DotNode.java:212)
at org.hibernate.hql.ast.tree.DotNode.resolve(DotNode.java:206)



if your hql query looks similar to: where user.addresses.state.abbreviation = 'WI';

try joining and creating an alias for the set of addresses: join user.addresses as adrs ... where ... adrs.state.abbreviation = 'WI';