I am a little confused when it comes to mapping inheritance in JPA (Hibernate Annotations)
I have an entity (AddressLookup) which has a subclass (Landmark). The parent entity is related to another entity (ServiceRequest) OneToMany.
I am using the Table per subclass (JOINED) mapping
pattern.
AddressLookup
Landmark
ServiceRequest
Now when writing a query how do I refer to Landmarks via ServiceRequests?
In order for the following to be valid, should I map Landmark to AddressLookup OneToOne?
Landmark landmark = serviceRequest.getAddressLookup.getLandmark();
It is not a problem going the other way since Landmark inherits getServiceRequestCollection from AddressLookup but ServiceRequest knows nothing of the subclass Landmark.
Thanks for any help.
-Brian