Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
amir55
Post subject: select in hibernate from a table  PostPosted: Oct 31, 2010 - 09:52 AM
Registered Member
Registered Member


Joined: Oct 15, 2005
Posts: 170

hi

I have a table called course_user in thsi shape

courseId userId
2 1
3 1

in sql we can do this

select courseId from course_user where userId = 1 ;

how ca we do that in hibernate ?

thanks a lot

Amir
 
 View user's profile Send private message  
Reply with quote Back to top
support-shalini
Post subject: RE: select in hibernate from a table  PostPosted: Nov 01, 2010 - 07:00 AM
Registered Member
Registered Member


Joined: May 18, 2009
Posts: 1532

amir55,

Here is the way you can select in Hibernate:

select courseuser.courseId from course_user courseuser where courseuser.userId = 1 ;

Do let us know how it works for you.

_________________
Shalini
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
amir55
Post subject:   PostPosted: Nov 07, 2010 - 09:36 AM
Registered Member
Registered Member


Joined: Oct 15, 2005
Posts: 170

hi dear Shirani

many thanks

the code of quering a table is not working
queryString = "select course.courseId from course_user where course.user.userId = 1" ;

the error is
course_user is not mapped

because the course_user is a table and not a class. Can you kindly enquire one of your hibernate team on how hibernate execute standard sql statements

many thanks with high appreciations

Amir
 
 View user's profile Send private message  
Reply with quote Back to top
support-joy
Post subject:   PostPosted: Nov 08, 2010 - 07:50 AM
Registered Member
Registered Member


Joined: Feb 03, 2009
Posts: 3242


_________________
Joy
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits