Hi,
I am new to Hibernate and would appreciate any insight into my problem.
Description:
--------------
Given the following tables and their columns:
Table_1 (id, name)
Table_2 (id, name)
......
Table_X (id, name)
Generic_Table (table_name, instance_id, status_id)
Status_Table (sid, svalue)
Generic_Table.instance_id could be table1.id or table2.id ....... tableX.id and table_name is the name of table of the corresponding instance_id.
Each table has a status associated to it via the Generic_Table.
Example:
-----------
Let's say we have in Status_Table:
sid = 1
svalue = 'deliver'
sid = 2
svalue = 'cancel delivery'
We insert into Table_1 some values:
Table_1.id = 103 ,
Table_1.name='pizza'
Therefore in Generic_Table we would have:
table_name= Table_1 ,
instance_id = 103 ,
status_id = 1 // which is deliver
Suppose we want to cancel the delivery of the pizza , we would want:
Generic_Table:
table_name= Table_1 ,
instance_id = 103 ,
status_id = 2 // which is CANCEL DELIVERY
Question:
------------
How would we define the relationship mapping in *.hbm.xml between the tables and the Status_Table via Generic_Table in order to create, update, read and delete?
Thank you very much!
-Deep
|