-->
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.  [ 8 posts ] 
Author Message
 Post subject: nesting joined-subclass
PostPosted: Sun Apr 24, 2005 10:21 am 
Newbie

Joined: Fri Apr 22, 2005 10:40 am
Posts: 9
Has somebody been able to nest joined-subclass to create multilevel inheritance?

In my case, the ID of the first 2 objects are the same but the third level object has a different id and it seems to be a problem,

could somebody help me with this?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 24, 2005 10:35 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
how are your third subclass related to the first two levels ? How should hibernate join'em ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 24, 2005 12:28 pm 
Newbie

Joined: Fri Apr 22, 2005 10:40 am
Posts: 9
First Class is a Person Class cointaining an id , first name last name
Second class is the Employee Class which extends Person by adding an employee id

Thirst class is an special kind of employee which brings a set of specialized properties.

I map the Person Class to a table that contains an id and other fields

The Employee to another table hwich contains only the person id and the employee id

and the EspecialEmployee table contains the employee_id and the rest of the info related to this class of employee

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 24, 2005 12:34 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Why doesnt SpecialEmployee just use PersonId as its id ?

Your relational model looks more like one where a Employee has a association to your special employee thingy.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 24, 2005 12:42 pm 
Newbie

Joined: Fri Apr 22, 2005 10:40 am
Posts: 9
yes you are right, but I have to live with the legacy database. I am just trying to create the most business oriented object model out of it.

The employee table with both the person_id and employee_id was created as a level of isolation interfacing between 2 systems


Another thing I tried was to create an Employee business object that is the join of the 2 tables employee and special employee and create an inheritance realtion with person

to do that I tried to create a joined-subclass in person to employee and inside it to join to the third table, but as far as I could go, hibernate's dtd doesnt allow a join inside a jonies-subclass

Fabricio


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 24, 2005 12:44 pm 
Newbie

Joined: Fri Apr 22, 2005 10:40 am
Posts: 9
Max,

would you take a look at this posting that is my business situation and give me advice in how would you map it?

I really appretiate your help

http://forum.hibernate.org/viewtopic.ph ... highlight=


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 24, 2005 12:51 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Sorry, but don't have time to do more than saying I would probably not let Employee extends Person - they sounds like two different things with associations in between.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 24, 2005 12:53 pm 
Newbie

Joined: Fri Apr 22, 2005 10:40 am
Posts: 9
Thanks Max, I suspected that was the only way


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