Annotation | Purpose |
---|---|
@Inheritance | Specifies type of inheritance strategy used |
@DiscriminatorColumn | Specifies a column in database which will be used to identify different entities based on certain ID assigned to each entity |
@MappedSuperClass | mapped super classes are not persistent and only used to hold state for its subclasses. Generally abstract java classes are marked with @MapperSuperClass |
@DiscriminatorValue | A value specified in column defined by @DiscriminatorColumn. This value helps identify the type of entity |
The advantage of single table strategy is it does not require complex joins for retrieval and insertion of entities, but on the other hand it wastes database space as many columns need to be nullable and there isn’t any data for them.
Complete example and article can be found here