-->
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.  [ 1 post ] 
Author Message
 Post subject: BillingDetails inheritance example question
PostPosted: Wed Jan 21, 2009 8:48 pm 
Newbie

Joined: Fri Feb 08, 2008 2:41 pm
Posts: 18
First of all I want to thank Christian for his excellent book Hibernate in Action.

Nevertheless I have a question regarding the table per subclass inheritance strategy. The example in the book uses the BillingDetails, Creditcard and BankAccount classes on page 204.
Let's say that you would use Person, Customer and Employee classes respectively.
Is it possible to have a Customer and Employee both refer to one row in the person table (using the joined strategy as described on pg 206-207)? All linked together with the same id?
Arguably ... a person can be both a customer and an employee (and even a systemuser).

If the answer is yes... why does Hibernate have problems loading a Customer and an Employee instance (referring to one person row) at the same time?

When having an invoice that references a customer and an employee, Hibernate doesn't
seem to differentiate between those two when setting the properties which turns into a class cast exception.


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

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.