Hibernate version: 3.1 rc2
Name and version of the database you are using: Sybase ASE 12
Here's my problem:
I'm trying to do a session.createQuery("select new myBean... but the hick is that one of the property of myBean is a set that will contain a mapped hibernate object (table2 objects).
Here's an example:
session.createQuery("select new myBean(table1.column1, table1.column2, table2) from table1 left join table2 where table1.id = :id)..setParameter( "id", new Long(11111)).list()
With "table2" I get the following error:
org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class [myBean] [select new ...
But without "table2" the query runs fine. Now, you need to know that I have two construtors in myBean, one with a SET and one without. I also have the join mapping (one-to-many) in table1 mapping.
I know I didn't give you everything you need to debug my problem but, I just want to know if this SHOULD be feasible or not. And, do I need JDK 5 for the Generics, to specify the type of SET the query will be returning (SET<table2>)?
Thanks
|