-->
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: Problems with delete-orphan and inheritance
PostPosted: Tue Mar 03, 2009 5:13 am 
Newbie

Joined: Fri Sep 26, 2008 10:48 am
Posts: 10
Hello,

I recently came upon several hibernate issues introduced by an inheritance mapping.

The situation:

* PriceInformation has a ScalePriceList
* ScalePriceList has two specializations (QuantityScalePriceList and DiscountGroupScalePriceList)
* Each of the specializations contains 0..n QuantityScalePrices or DiscountGroupScalePrices respectively
* The latter ScalePrices inherit from a parent class called ScalePrice

I use SINGLE_TABLE strategy as inheritance is used mainly because of type safety and those classes don't contain many properties.

My problems:

1. DELETE-ORPHAN doesn't work for the OneToOne relationship of PriceInformation and ScalePriceList. I also found a bug report (HHH-2608) on that.

2. Because of the SINGLE_TABLE strategy, the table for the ScalePrices contains two foreign key columns (one for each of the parent list) which must be nullable. Here, DELETE-ORPHAN only sets the reference to "null" instead of deleting the orphan. I guess this is because of the "nullability-constraint", because if I set one of the columns to be not nullable, the orphan entry is deleted.

Even a bidirectional relationship betweed ScalePriceList and ScalePrice doesn't seem to change much.


Actually I'm not asking for a solution on both problems, but it would be great if someone could confirm these. Maybe a table per class mapping could at least solve problem 2.


Best regards,

Fabian

Hibernate version: 3.2.6.GA


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 03, 2009 7:10 am 
Newbie

Joined: Fri Sep 26, 2008 10:48 am
Posts: 10
I did solve the problem by using merge() instead of saveOrUpdate().

Can someone tell me what impact merge() has on associations with delete-orphan cascading?


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.