Module storm
Package st.orm

Annotation Interface PK


Marks a field as the primary key of an entity. This annotation can also specify the database column name for the primary key using either value() or name(). These attributes are aliases: if both are provided, they must have the same value.

Usage examples:

  • @PK("id")
  • @PK(name="id")
  • @PK @DbColumn("id")
Each sets the primary key column name to "id".

If no value is specified (i.e., both value() and name() are ""), the automatic column name resolution strategy will be applied.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Whether the primary key is auto generated.
    The database column name for the primary key.
    The database column name for the primary key.
  • Element Details

    • value

      String value
      The database column name for the primary key. Acts as an alias for name().
      Default:
      ""
    • name

      String name
      The database column name for the primary key. Acts as an alias for value().
      Default:
      ""
    • autoGenerated

      boolean autoGenerated
      Whether the primary key is auto generated.
      Returns:
      true if the primary key is auto generated, false otherwise.
      Default:
      true