-->
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: class inheritance using joined-subclass
PostPosted: Mon Nov 03, 2003 12:12 pm 
Newbie

Joined: Mon Nov 03, 2003 11:38 am
Posts: 4
I am new to Hibernate. I am looking for best practice advices when deleting inheritance implemented by using joined-subclass (table per class).

Description:

Using table per class approach.

An abstract base class, PERSON. A concrete sub-class, EMPLOYEE, of PERSON. Another concrete subclass, SALESPERSON, of EMPLOYEE. Both EMPLOYEE and SALESPERSON use joined-subclass in the mapping file. I understand an employee and a sales person share the same key as a person.

Questions:

How to ONLY delete a sales person without deleting the employee?
How to AUTOMATICALLY delete the sales person when deleting a particular employee? (This is similar to cascade delete but to its subclasses.)

Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 03, 2003 12:20 pm 
Regular
Regular

Joined: Tue Sep 16, 2003 11:35 am
Posts: 93
Location: San Francisco, CA
In the same way that you can't change an object's class in Java after it has been instantiated, you wont be able to change your SALESPERSON into an EMPLOYEE.

It seems like your domain model requires some one-to-one mappings rather than joined-subclass.


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.