8.12.9 @DiscriminatorValue
- Organization of this subsection
(1) Description
This annotation specifies the value of the column for identification used in the SINGLE_TABLE strategy or JOINED strategy. You can specify this annotation in a superclass or subclass.
The applicable target is class.
Note the following points:
-
The settings of @DiscriminatorValue are not inherited. @DiscriminatorValue must be set up in each entity class.
-
The settings of @DiscriminatorValue must match the type specified in discriminatorType and length specified in length of @DiscriminatorColumn.
-
If the discriminatorType of @DiscriminatorColumn is INTEGER, make note of the following points:
-
In @DiscriminatorValue, specify only an integer that does not include 0 or a blank at the beginning.
-
You cannot omit @DiscriminatorValue. If omitted, the operation will not be guaranteed.
-
-
If the discriminatorType of @DiscriminatorColumn is other than INTEGER, you can omit @DiscriminatorValue. In such a case, the operation is performed by assuming that the value specified in value is the class name of the entity.
(2) Element
The following table lists the elements of @DiscriminatorValue:
Element name |
Optional/Required |
Element description |
---|---|---|
Required |
This element specifies the value to be set up in the column for identification. |
The details of attributes that are supported with Cosminexus JPA provider are as follows:
(a) value element
- Type
-
String
- Description
-
This element specifies the value to be set up in the column for identification.
The value that can be specified depends on the type of the column for identification.
- Default value
-
Entity name