Package jakarta.nosql

Annotation Interface Id


@Retention(RUNTIME) @Target({FIELD,PARAMETER}) public @interface Id
Identifies the primary key of an entity. Specifies the mapped field of an entity as the entity’s ID, or the Key in Key-Value databases. The field or property to which the Id annotation is applied should have one of the following types: Or it uses the Convert to convert the type to one of the above types.

The mapped column for the primary key of the entity is assumed to be the primary key of the database structure.

Example:

 
 @Id
 public Long id;
 
 

An insertion with an ID value might vary from the vendor, where vendors can throw a NullPointerException, for example, a Key-value database, or apply a strategy of auto generating value, for example, UUID or auto-increment.

Since:
1.0.0
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The name of the entity ID.
  • Element Details

    • value

      String value
      The name of the entity ID. Default value is _id. This value might be ignored if the NoSQL database has a keyword reserved for keys. For example: @Entity public class User { @Id private String userName; }
      Returns:
      the entity ID name
      Default:
      "_id"