-->
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.  [ 2 posts ] 
Author Message
 Post subject: Help designing a mapping document for schema
PostPosted: Tue Jul 19, 2005 2:27 pm 
Newbie

Joined: Tue Jul 19, 2005 1:28 pm
Posts: 17
Hibernate version : 3

Database: MySQL 4.1

Problem:

Hi I am new to using Hibernate and I am not able to design a mapping document for the following scenario.

Facility_Table:
FacilityID, primary key
other fields

StateFields_Table:
FieldID, primary key
FieldName, varchar


Facility_State_Fields_Table (Association table)
FacilityID, primary key
StateFieldID, primary key
FieldValue, varchar

How should I create a mapping document to relate Facility table with the Facility_State_Fields_Table. If you see the tables, the fieldValue in the associate table is an extra field compared to the StateFields_Table.

Sorry if this is a lame question. But if someone can guide me, I will be very greatful.

Thanks in advance

Phani


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 20, 2005 3:00 am 
Beginner
Beginner

Joined: Fri Feb 11, 2005 12:03 pm
Posts: 48
Location: Kiel, Germany
Hi,

as far as I understood from the online documentation and the very good book "Hibernate in Action" you can model the association as a many-to-many association using a composite-element or (perhaps easier) define an entity class for your association and use two one-to-many associations.

In the latter case you would therefore have entity classes Facility, StateFields and FacilityStateFields.
Facility has a one-to-many association to FacilityStateFields and StateFields has a one-to-many association to FacilityStateFields.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.