Package jakarta.nosql

Annotation Interface DiscriminatorValue


@Retention(RUNTIME) @Target(TYPE) public @interface DiscriminatorValue
Specifies the value of the discriminator column for the annotated entity type.

The DiscriminatorValue annotation can only be specified on a concrete entity class. Specifies the value of the discriminator column for entities of the given type.

The DiscriminatorValue annotation can only be specified on a concrete entity class.

If the DiscriminatorValue annotation is not specified and a discriminator column is used, a provider-specific function will be used to generate a value representing the entity type. So the discriminator value default is the Class.getSimpleName().

Example usage of the DiscriminatorValue annotation:


 @Entity
 @DiscriminatorValue("Mammal")
 public class Animal {
     // Animal-specific fields and methods
 }

 @Entity
 @DiscriminatorValue("Dog")
 public class Dog extends Animal {
     // Dog-specific fields and methods
 }
 
Since:
1.0.0
See Also:
  • Required Element Summary Link icon

    Required Elements
    Modifier and Type
    Required Element
    Description
    (Optional) The value that indicates that the row is an entity of the annotated entity type.
  • Element Details

    • value Link icon

      String value
      (Optional) The value that indicates that the row is an entity of the annotated entity type.
      Returns:
      the discriminator Value