three entity : student ,teacher,task relationship: teacher to student , one to many; teacher to task,many to many the business process is sample,like this:
first, every student must have a teacher, this is easy to be done with hibernate student_id teacher_id student_a teacher_a stundet_b teacher_a stundet_c teacher_b
then teacher need to publish a task,and add a score to the task ,this can be done by create a middle table entity with hibernate,alao can be done easily teacher_id task_id score teacher_a task_a 10 teacher_a task_b 5 teacher_b task_a 6
finally,the student must finish the task their teacher publish, because what task student should do is actually decided by those two relationship above,now need a fact table to record the progress of each task belong to student,like this: student_id teacher_id task_id score progress student_a teacher_a task_a 10 75% student_a teacher_a task_b 5 10% student_b teacher_a task_a 10 22% student_b teacher_a task_b 5 11% student_c teacher_b task_a 6 7%
now the problem is coming, I don't know how to create this fact table use hibernate,the solution I hope that is once I make sure the relationship,this fact table can be generated autolly,I was a new learner of hibernate,please give me the core and explain as detailier as possible,thanks
|