Package jakarta.nosql

Annotation Interface Inheritance


@Retention(RUNTIME) @Target(TYPE) public @interface Inheritance
Specifies the inheritance mapping strategy for the entity class hierarchy, which descends from the annotated entity class. Specifies the inheritance strategy to be used for an entity class hierarchy. It is specified on the entity class that is the root of the entity class hierarchy. This class can be either a regular or an abstract; The NoSQL database structure will have a column for every attribute of every class in the hierarchy. The subclass will use the Entity name from that class with this annotation.

 @Entity
 @Inheritance
 public abstract class Notification {
     @Id
     private String id;

     @Column
     private String recipient;
 }

 @Entity
 public class SMSNotification extends Notification {

     @Column
     private String phoneNumber;
 }

 @Entity
 public class EmailNotification extends Notification {

     @Column
     private String email;
 }
 
Since:
1.0.0
See Also: