Defines a class whose mapping information is applied to entities that inherit from it.
Unlike regular entities, a mapped superclass does not imply the existence of separate storage
structures.
Declares a class that is not itself an entity, but whose mappings are inherited by entities that extend it. A mapped superclass is not a persistent type and is not mapped to a specific database structure.
The persistent fields and properties of a mapped superclass are declared and mapped using the same mapping annotations used to map entity classes. However, these mappings are interpreted in the context of each entity class that inherits the mapped superclass, since the mapped superclass itself does not have a predefined storage structure in NoSQL databases.
Example:
@MappedSuperclass
public class Employee {
@Id
protected Integer id;
@Column
protected Address address;
}
@Entity
public class Programmer extends Employee {
@Column
protected Money salary;
}
- Since:
- 1.0.0