problem in retrieving the rows in case of composite key through hibernate
I have faced this issue many times but couldn't find the solution any where.
My question is that how can i retrieve a tuple or a row in the database through hibernate call,
For ex开发者_JAVA百科ample in the relation Student_course(sid,sname,cid,cname, duration) here sid and cid are considered as the composite key.
please let me know the solution.
Thanks In Adv, A.Raghavendra
Configure the Mapping file as below,
<hibernate-mapping>
<class
name="com.example.StudentCourse"
table="Student_course">
<composite-id>
<key-many-to-one name="student" class="com.example.Student" column="student_ID"/>
<key-many-to-one name="course" class="com.example.Course" column="course_ID"/>
</composite-id>
///Other mappings elements
In the java, if you retrive the List of Student course you can get the details.
精彩评论