Hello,
I've the following three tables: Customer, Flight and Booking.
Customer and Flight do have their own PKs, whereas Booking is defined by the ID of Customer and Flight.
However hibernate complains it cant't find the type for the customer column:
Code:
Caused by: org.hibernate.MappingException: Could not determine type for: dst1.model.Customer, at table: Booking, for columns: [org.hibernate.mapping.Column(customer)]
Any idea what is causing the problem?
Thank you in advance, Clemens
Code:
@Entity
public class Flight {
@Id @GeneratedValue
Long id;
@OneToMany(mappedBy="id.flight", cascade={CascadeType.REMOVE})
List<Booking> bookings = new ArrayList<Booking>();
}
@Entity
public class Customer extends Person {
@Id @GeneratedValue
Long id;
@OneToMany(mappedBy="id.customer", cascade={CascadeType.REMOVE})
List<Booking> bookings = new ArrayList<Booking>();
}
@Entity
public class Booking {
@EmbeddedId
BookingID id;
}
@Embeddable
public class BookingID implements Serializable {
@JoinColumn(name="customer_id", referencedColumnName="id")
Customer customer;
@JoinColumn(name="flight_id", referencedColumnName="id")
Flight flight;
}