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
|