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: Inheritance Mapping
PostPosted: Tue Sep 16, 2008 1:59 pm 
Newbie

Joined: Mon Aug 18, 2008 1:07 pm
Posts: 3
Hi Guys,

I'm trying to do some inheritance mapping. I basically have 4 classes called Allotment, TrainingDays, VacationDays and SickDays. The first one is the base class and does not map to a database table, but the other three that inherit from it each map to a different table.

So basically the Allotment class has:

Id - Primary Key
Year
EmployeeId - Which would map to employee class
AllottedDays

TrainingDays, and SickDays inherit from it with no extra information. Those map to T_TrainingDays and T_SickDays respectively. VacationDays has an additional column called CarryOver. I don't know if this makes sense at all but could anyone point me in the right direction or is it even possible to do this? Thanks

EDIT: I guess basically I have 4 classes and 3 tables.



Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 16, 2008 4:52 pm 
Regular
Regular

Joined: Tue Oct 16, 2007 9:45 am
Posts: 93
Ok let me point you: NHibernate reference manual, chapter 8. called Inheritance Mapping.
You want to look at the third strategy called: table-per-concrete-class as that is what you are describing.


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.