Hibernate version: 2.0
I do not know how to map this situation, who can help?
I have a class OrderLine with an abstract property Booking. The Booking can be of different concrete types (like Hotel, Flight, Car)
like this:
Code:
public abstract class ProductBooking
{
/// <summary>
/// Booking of the product. Must be implemented (overridden) in derived class
/// </summary>
/// <returns></returns>
public abstract bool Book();
....
}
public class Orderline
{
public virtual ProductBooking Booking
{
....
}
From an OO perspective, this is pretty need because when an Order contains OrderLines, and all of the products must be booked, the Order does not care what KIND of products are on the order. We can book them all by a simple loop.
However I have the following database table:
Orderline with columns HotelBooking, FlightBooking, CarBooking
Those columns contain the primary key of the tables that contain the actual products (Hotel, Flight, Car). How should this be mapped?
That is, how can I map the property OrderLine.ProductBooking to different classes within the mapping file for the orderline class?
Is it possible to define subclasses for a PROPERTY of a class in a mapping file? If yes, how?