Package st.orm

Class AbstractKeyMetamodel<T extends Data,E,V>

java.lang.Object
st.orm.AbstractMetamodel<T,E,V>
st.orm.AbstractKeyMetamodel<T,E,V>
Type Parameters:
T - the primary table type.
E - the field type of the designated element.
V - the value type of the designated element.
All Implemented Interfaces:
Metamodel<T,E>, Metamodel.Key<T,E>

public abstract class AbstractKeyMetamodel<T extends Data,E,V> extends AbstractMetamodel<T,E,V> implements Metamodel.Key<T,E>
Extension of AbstractMetamodel that implements Metamodel.Key, indicating that the field has a uniqueness constraint.

The metamodel processor generates instances of this class for record components annotated with @UK or @PK (which is meta-annotated with @UK).

Since:
1.9
  • Constructor Details

    • AbstractKeyMetamodel

      public AbstractKeyMetamodel(@Nonnull Class<E> fieldType)
    • AbstractKeyMetamodel

      public AbstractKeyMetamodel(@Nonnull Class<E> fieldType, @Nonnull String path)
    • AbstractKeyMetamodel

      public AbstractKeyMetamodel(@Nonnull Class<E> fieldType, @Nonnull String path, @Nonnull String field, boolean inline, @Nullable Metamodel<T,?> parent)
    • AbstractKeyMetamodel

      protected AbstractKeyMetamodel(@Nonnull Class<E> fieldType, @Nonnull String path, @Nonnull String field, boolean inline, @Nullable Metamodel<T,?> parent, boolean isColumn)
    • AbstractKeyMetamodel

      public AbstractKeyMetamodel(@Nonnull Class<E> fieldType, @Nonnull String path, @Nonnull String field, boolean inline, @Nullable Metamodel<T,?> parent, boolean isColumn, boolean nullable)
      Constructs a key metamodel with explicit column and nullable flags. This constructor is used by the metamodel processor to propagate the nullable status of unique key fields to the runtime.
      Parameters:
      fieldType - the field type.
      path - the path to the table.
      field - the field name.
      inline - whether this is an inline record field.
      parent - the parent metamodel.
      isColumn - whether this metamodel corresponds to a database column.
      nullable - whether this key allows duplicate NULLs (nullable with nullsDistinct = true).
      Since:
      1.9
  • Method Details

    • isNullable

      public boolean isNullable()
      Description copied from interface: Metamodel.Key
      Returns true if this key field allows NULL values with standard SQL distinct-NULL semantics, meaning the UNIQUE constraint does not prevent multiple NULLs.

      A nullable key is unsafe for keyset pagination because WHERE key > cursor silently excludes NULL rows. The scroll methods check this flag and throw a PersistenceException if the key is nullable.

      Specified by:
      isNullable in interface Metamodel.Key<T extends Data,E>
      Returns:
      true if this key allows duplicate NULLs (nullable with nullsDistinct = true), false otherwise.
      See Also: