1) Yes. This can be done using MappedSuperclass and annotate your columns
@MappedSuperclass abstract public class Person { @Column(name="PERSON_NAME") private String name; } @Entity public class Employee extends Person { @Column(name="EMPLOYEE_NAME") private String name; }
2) No. Without changing the attribute names of one of the persons or employees. However, you can query for all objects of a person with this name and pass the results to employees. Another option is to use Native SQL to query the column you want, again, probably not perfect.
SELECT p FROM Person p WHERE p.name = "test";
source share