-->
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: data model
PostPosted: Fri Mar 28, 2008 7:17 am 
Newbie

Joined: Fri Mar 28, 2008 7:00 am
Posts: 2
we are using Hibernate and came up with a model like this.
Each Vessel
---- has a Set of Positions
----------Each Position has a Set of Hatches.

So three tables to represent this . This looks fine.
However the the data to be stored differs on cargo type.
If it is a bulk cargo we have hatches , for petrol we have no hatches.

VESSEL
|
|
CARGODETAIL
^ ^
| |
BULK TANKER
|
HATCH

BULK and TANKER are 2 types of cargo and HATCH is associated only to bulk
Should we go for table per class hierarchy to store both BULK AND TANKER using a discriminator(cargo type) or go for table per subclass.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 28, 2008 8:02 am 
Newbie

Joined: Tue Mar 18, 2008 12:37 pm
Posts: 4
For as much as i've understood, both BULK and TANKER have the same attributes. Their only difference would be an hatcher Set inside the BULK object.
Due to this, i see no point in using a table per subclass, which could be useful when you have many different attributes among the subclasses. I would instead using a table per class hierarchy approach.
The Hatch set will then be mapped using a many-to-one relationship inside the BULK specific mapping.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 29, 2008 12:36 am 
Newbie

Joined: Fri Mar 28, 2008 7:00 am
Posts: 2
thanks

The BULK object has a set of POSITON and TANKER also has a set.
for a BULK object all the info about a position goes into the hatches table.
However for tanker the info goes directly into the hierarchy table.
Do you think the object model looks good in this scenario


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.