Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 0.5.5-RC1
-
Component/s: None
-
Labels:None
Description
Part of the problem as described by DuyNguyen to the user mailing list:
I have the following domain class: Item, ItemWithPrice,
ItemWithPriceAndImage
I execute the following:
new ItemWithPriceAndImage(name: "Pen", price: 10, imageURL: "....").save()
I look up the database and see that the new record have price = NULL
Why didn't the price get inserted?
The "class" column of the database is set to ItemWithPriceAndImage, but I
think ItemWithPriceAndImage "is-a" ItemWithPrice, so every property should
be persisted as well.
Moreover, what if I add another class called
ItemWithPriceAndImageAndDescription?
class Item{
String name
}
class ItemWithPrice extends Item{
int price
}
class ItemWithPriceAndImage extends ItemWithPrice{
String imageURL
}
-------------
It's my (masukomi) opinion that anything deeper than one level of inheritence in domain models is just completely broken, as in just about everything that should come via inheritence doesn't.
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits