-
Hibernate Parent/Child (2 messages)
- Posted by: kishore kumar
- Posted on: September 04 2006 08:34 EDT
I have two tables: first table contains course,unit,lesson details. second table contains many-to-one relationship between course and units. It means a course contains many units and a unit contains many lessons. First Table: Id contentName contentType 1 course1 course 2 lesson1 lesson 3 lesson2 lesson 4 unit1 unit 5 unit2 unit Second Table: contenId refId 2 1 3 1 4 2 5 2 For this scenario, how to write hbm file and mapping java class files. Any help would be greatly appreciated.Threaded Messages (2)
- Re: Hibernate Parent/Child by Christopher Stach II on September 05 2006 09:27 EDT
- use by Stephen Cooper on September 05 2006 10:07 EDT
-
Re: Hibernate Parent/Child[ Go to top ]
- Posted by: Christopher Stach II
- Posted on: September 05 2006 09:27 EDT
- in response to kishore kumar
-
use [ Go to top ]
- Posted by: Stephen Cooper
- Posted on: September 05 2006 10:07 EDT
- in response to kishore kumar
Since you have only one table storing three different classes, I would suggest that you make use of the feature of hibernate. e.g. select * from first_table where contentType='lesson' ... this will give you what appears to be three different tables - one for each concept/class. then, you use use the documentation at hibernate.org to create a one-to-many relationship between courses and units.