-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Defining Mapping in Hibernate
PostPosted: Fri Feb 25, 2005 4:53 pm 
Newbie

Joined: Fri Feb 25, 2005 12:53 pm
Posts: 3
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


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 26, 2005 11:00 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Please post this question in the regular Hibernate User forum.


Top
 Profile  
 
 Post subject: Generic mapping
PostPosted: Sat Mar 05, 2005 8:56 pm 
Newbie

Joined: Mon Jan 24, 2005 11:18 pm
Posts: 1
Hi,

I find the question interesting, since it's the same design implemented for AuditLog topic.

To know how we map theses tables I'll appreciate too.

Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.