I have the following problem. I have an abstract class called Vehicle, this class is annotated with MappedBySuperclass. Then I have lots of classes extending that abstract class, such as Car, Boat, Bicycle, Motorcycle etc etc etc. I also have a class called Person. A person owns a set of vehicles. I would like the relation to look like this
@Entity
class Person {
@OneToMany
List<Vehicle> vehicles;
...
}
The problem is that Vehicle is an abstract class and not an entity-class directly. Is there any way in JPA I can use this kind of reference without referring directly to the entity-class?