| Author |
Hibernate mapping problem
|
Vu Le
Greenhorn
Joined: Nov 08, 2006
Posts: 2
|
|
Hi, i have the following DB table, very simple CLASS ------- class_id class_name STUDENT --------- student_id student_name STUDENT_STATUS -------------- student_id class_id midterm_score final_score my mapping is as follow The whole point is when a user click on any of the classes, an html table will show the list of students with their name, midterm score and final scores. I just start using Hibernate yesterday, and not sure how to fix the mapping to also retrieve the midterm_score and final_score. Any help is appreciated. Thank you [ Edited to include code tags - Paul Sturrock ] [ November 09, 2006: Message edited by: Paul Sturrock ]
|
 |
Amirtharaj Chinnaraj
Ranch Hand
Joined: Sep 28, 2006
Posts: 215
|
|
hi le i think you should add the many-to-many relation tag attribute for the student table .and then you have to use the link table properly .i think its better to play with one-to-many in the initial stage. regards amir
|
 |
Vu Le
Greenhorn
Joined: Nov 08, 2006
Posts: 2
|
|
I was thinking of breaking up the STUDENT_STATUS table into: STUDENT_STATUS -------------- student_id class_id entry_id (Primary Key) STATUS ------------ entry_id (Primary Key) midterm_score final_score ... and use one-to-one mapping. I think it will work but just a waste to have another table just for hibernate to work. Does anyone has a solution to not having to split the table. Thank you
|
 |
Amirtharaj Chinnaraj
Ranch Hand
Joined: Sep 28, 2006
Posts: 215
|
|
well le you can try with this set-up two tables having primary and foregin key each other (i.e) table1 Pk is FK in table2 and table1 FK is PK in table2 regards amir
|
 |
 |
|
|
subject: Hibernate mapping problem
|
|
|