This content has been marked as final.
Show 1 reply
-
1. Re: Using a constructor expression in a SELECT clause
santana2008 Aug 14, 2009 7:02 PM (in response to santana2008)<blockquote>
_Mohammed Ali El Karama wrote on Aug 14, 2009 18:46:_<br/>
Hi,
I am trying to use a constructor expression in a SELECT clause.
this is the example :
query :
select new mypackage.DTOCourse(t, (select c from Course as c where t in c.teachers)) from Teacher as t";
class :
class DTOCourse {
Teacher teacher;
List<Course> courses;
public DTOCourse(Teacher teacher, List<Course> courses) {
this.teacher = teacher;
this.courses = courses;
}
}
where we have many to many association between teacher entity and course entity.
the execution fails, sql exception : "expression absente"
how can i construct my DTOCourse using the teacher and the teachers courses as parameters ?
10x in advance.
</blockquote>
Click HELP for text formatting instructions. Then edit this text and check the preview.