Hibernate version: 2.1
I'm trying to execute the following piece of code (using springframework)
Code:
public List getProductTree() {
try {
List l = getHibernateTemplate().createQuery(getSession(),
"select new nl.xiam.infomas.sx.ps.TreeNode(pg.titles) "+
"from nl.xiam.infomas.sx.model.ProductGroup pg").list();
return l;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
And I get the following hibernate query exception:
Code:
net.sf.hibernate.QueryException:
expecting 'elements' or 'indices' after:
id [select new nl.xiam.infomas.sx.ps.TreeNode(pg.titles) from
nl.xiam.infomas.sx.model.ProductGroup pg]
at net.sf.hibernate.collection.CollectionPropertyMapping.toType(CollectionPropertyMapping.java:53)...etc...
basically its
Code:
select new Bar(f.prop) from Foo f
. The titles is a map instance. Foo is mapped, bar is not. For all the examples I've seen this should work.
I tried a couple of alternatives, but each time I try to use 'new' it just doesn't want to do it. I know I must not be understanding the syntax right.
Any ideas?