Annotation Interface KeyComponent


@Target({FIELD,METHOD}) @Retention(RUNTIME) @Documented public @interface KeyComponent
Marks a field or getter method as contributing to a composite key component.

The component() value identifies the key component name (e.g. "PK" or "SK"). The position() defines the ordering of parts within a composite key. Multiple fields or methods with the same component name and different positions are concatenated with # separators at runtime.

Used together with @Entity for single-table designs.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    @NonNull String
    The key component name (e.g.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    int
    The ordering position within the composite key (lower values come first).
  • Element Details

    • component

      @NonNull String component
      The key component name (e.g. "PK" or "SK").
      Returns:
      the component name
    • position

      int position
      The ordering position within the composite key (lower values come first).
      Returns:
      the position index
      Default:
      0