@MappedSuperclass This annotation can be used when you want to create inheritance in the Entities. Entities may inherit from superclasses that contain persistent state and mapping information but are not entities. That is, the superclass is not decorated with the @Entity annotation and is not mapped as an entity by the Java Persistence provider. These superclasses are most often used when you have state and mapping information common to multiple entity classes. Mapped superclasses are specified by decorating the class with the annotation javax.persistence.MappedSuperclass : @MappedSuperclass public class Employee { @Id protected Integer employeeId; ... } @Entity public class FullTimeEmployee extends Employee { protected Integer salary; ... } @Entity public class PartTimeEmployee extends Employee { protected Float hourlyWage; ... } Mapped superclasses cannot be queried and can’t be used in EntityManager or Query ...
This is my personal blog for the things that i do at work. I will post the interesting stuff that i do at my day to day work. It can work as a revision for me on the things that i have done.