I am trying to map a JPA (using Hibernate now) Many-to-one relationship with a polymorphic type, but I am having no luck. I don't see why it isn't possible, or why I would be forced to declare a concrete type in the mapping. Here is an example:
@MappedSuperclass
class BaseClass {
@Id
long id;
}
class ClassWithList extends BaseClass {
String attribute;
@OneToMany(mappedBy="backPointer")
List<ListClass> list;
}
class ListClass extends BaseClass {
String listItemData;
@ManyToOne
@JoinColumns({
@JoinColumn(name="baseId"),
@JoinColumn(name="baseType"),
})
BaseClass backPointer;
}
Thanks for any advice you can give.