Recently, I am trying to introduce interfaces for some of my hibernation-related objects and cannot figure out how to configure the mapping.
When I used the interface without any further declarations, I always got the following exception:
org.hibernate.MappingException: Could not determine type for: ...MyInterface
Then I found out that everything works fine when I define targetEntity explicitly:
@OneToOne(targetEntity=InterfaceImpl.class) private MyInterface myInterface;
Unfortunately, this solution does not work in my case: I cannot determine targetEntity via annotation, because I want to extract this class into a shared external library that will not contain or even know the final implementation of the interface.
So, is there an alternative way to declare which implementation should be used that I could use outside the extracted library? 
Pumuckline
source share