Hibernate Classes and Subclasses
Hibernate Classes and Subclasses
Limitation:-
super class columns repeat in the sub class table
hence duplicate columns
-Annotations used
@MappedSuperClass instead of @Entity for the superclass
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
@AttributeOverrides
This annotation allows the super class column names to be changed in subclass table
________________________________________________________
Student
-------
int rollno
String studentName
Date admissionDate
Address perAddr
2 subclasses
PrimaryStudent
--------------
String grade
SecondaryStudent
--------------
float percentage
________________________________________________