Community
Participate
Working Groups
@Entity @Table(name="BUYER") public class Buyer {} @Entity @Table(name="BUYER") public class GoldBuyer extends Buyer {} In this example we give a validation error on the GoldBuyer @Table annotation: "No table should be defined for non-root entity "GoldBuyer" using single-table inheritance." We should change the validation logic to check to see if the specified table is the same as the inherited table. This could be a case where the user just wants to be more explicit rather than relying on defaults. Workaround is to disable this validation or turn it into a warning in the JPA error/warnings preferences.
Created attachment 192583 [details] proposed bug fix patch
Be careful with the use of "specified" calls here for the child Entity. Since you are asking for specified qualifiers, these will often be null (when not specified), and will mis-compare with the default values that are retrieved from the root table. Would be better to use the isSpecifiedInResource() API on table and then use getCatalog, getSchema, getName to ensure that defaults are picked up. Also, case sensitivity needs to be considered here when comparing defaults against specified values.
Created attachment 193082 [details] patch with additional recommended changes Addition recommended changes, added check for active db connection and compared parent/child db table objects rather than just the names.
Created attachment 193281 [details] patch with additional recommended changes
Patch reviewed, tested, and committed to head.