Hibernate version: Entity Manager 3.3.1.ga
Mapping documents:
@Entity
public class MyEntity {
@Id
public Long id;
public List<MyOtherEntity> others;
}
I have a class MyClass with the constructor MyClass(Long, List<MyOtherEntity), when I try to make a query like:
"select new MyClass(c.id, c.others) from MyEntity c"
I get an exception because Hibernate is expecting that the constructor is MyClass(Long, MyOtherEntity). Seems that whants to create an instance for each element of the list.
How shoud I write the query to get for each object the Id and the List associated to the field 'others' ?
Thanks
|