-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate Criteria question - V2.17c
PostPosted: Fri Dec 30, 2005 3:14 pm 
Newbie

Joined: Thu Apr 15, 2004 12:00 pm
Posts: 13
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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 01, 2006 11:43 pm 
Regular
Regular

Joined: Fri Sep 09, 2005 11:35 am
Posts: 101
you should have posted your mapping files. i am doing guesswork here.

you may have lazy="false" for this relationship.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.