I have some entities B and C inheriting from a parent entity A. Hence, I have a joined, multiple inheritance structure in my database.
Furthermore, I have defined some @NamedQueries on these entitites which work well.
I intend to have a @NamedStoredProcedureQuery which is able to find some POIs in a perimeter. I have already implemented a stored procedure which performs a SELECT on the parent table, getting longitude,latitude and radius as parameter and a CALL returns the correct records. The columns to perform the perimeter search are all in the parent table/entity.
Now I want to call this stored procedure from Java using JPA related to the inherited entity. This means that a perimeter search for entities of class B shall return all POIs of class B within the perimeter.
Is it sufficient to define the @NamedStoredProcedureQuery in the parent entity class?
How can I call such a @NamedStoredProcedureQuery from within a @NamedQuery in a subclass?