Is it possible to map only the concrete classes to existing tables while not mapping the abstract class onto a table itself?
Example:
I have a one-to-one relation from an OrderLine class to an abstract Product class. So, product is a property(component) of OrderLine.
Now I only have tables for the OrderLine itself and the concrete products Car, Hotel, Insurance.
That is, within the Orderline-Table there are foreign keys for these concrete classes like this:
OrderLineTable
columns..
HotelId (FK to HotelProduct table)
CarId (FK to CarProduct table)
InsuranceId (FK to Insurance table)
I wanted to map this in the Orderline mapping file with a one-to-one relation to Product, but than I have to specify a table for the abstract Product class.
I do not want to change the database: What would be the best approach here?
|