-->
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.  [ 4 posts ] 
Author Message
 Post subject: Lazy question
PostPosted: Wed Nov 05, 2003 4:47 pm 
Expert
Expert

Joined: Tue Sep 16, 2003 4:06 pm
Posts: 318
Location: St. Petersburg, Russia
This question is "lazy" in Gavin's terms because I did not search all the documentation, just checked it quickly :)

I have classes A and B.
A lives in TBL_A, B is in TBL_B.
B extends A and mapped using <joined-subclass>

As I see, when use I session.delete(objectB), this removes records from both tables.

The quesion is: my I control this behavior? I need to delete only "subclass" part of the class, leaving its "base" in the database.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 05, 2003 7:10 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
It is a nonsense as B extends A, so B is A. Can't delete something wo deleting it

_________________
Emmanuel


Top
 Profile  
 
 Post subject: suggestion: one to one relationship instead of joined-sub...
PostPosted: Wed Nov 05, 2003 7:16 pm 
Regular
Regular

Joined: Sun Sep 21, 2003 11:43 pm
Posts: 85
Location: Massachusetts
You might be better off with a one-to-one relationship. That way, you could have that optional portion exist or be null. You'd just have to access it like a component. If you delete the component, you still have the main 'object' in your main table.

Regards,
David


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 06, 2003 3:32 pm 
Expert
Expert

Joined: Tue Sep 16, 2003 4:06 pm
Posts: 318
Location: St. Petersburg, Russia
Good idea, David.
Thanks


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