Hi,
When we use Criteria and then createAlias, Hibernate uses inner join in final sql. Also the selected columns will be the total number of columns(columns from root class table+ columns from inner join classe tables).
My question is:
I am using the following code and it's generating the following sql statement but I want to control the select part is there any way if we usae hibernate V2.17c? I appreciate your help.
Code:
Criteria criteria = session.createCriteria(Student.class);
criteria.createAlias("courses", "courses");
criteria.list();
Generated sql:
select <columns from student table> + < columns from course table>
from student this inner join course course_1 on course_1.course_id =this.course_id
My need:
Instead of above sql I want to see something like this.
select <columns from student table>
from student this inner join course course_1 on course_1.course_id =this.course_id
relationship between student and course is 1 to n
I appreciate youe prompt response.
Hibernate version:2.17c
Name and version of the database you are using:oracle
|