- Type Parameters:
T- the root table type.E- the field type of the designated element.
- All Superinterfaces:
Metamodel<T,E>
- All Known Implementing Classes:
AbstractKeyMetamodel,Metamodel.KeyDelegate
@UK or @PK record components implement this interface automatically.
Key instances can be used where a unique column is required, such as keyset pagination cursors and
single-result lookups via repository methods like findBy and getBy.
A Key can also be created manually via the Metamodel.key(Metamodel) factory method for columns that
are known to produce unique values in a specific query context (for example, a column used in a GROUP BY
clause). In such cases, the caller is responsible for ensuring that the values are unique within the result set;
using a non-unique column as a keyset pagination key silently skips rows when duplicates span page
boundaries.
- Since:
- 1.9
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface st.orm.Metamodel
Metamodel.Key<T extends Data,E>, Metamodel.KeyDelegate<T extends Data, E> -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif this key field allows NULL values with standard SQL distinct-NULL semantics, meaning the UNIQUE constraint does not prevent multiple NULLs.
-
Method Details
-
isNullable
boolean isNullable()Returnstrueif 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 > cursorsilently excludes NULL rows. Thescrollmethods check this flag and throw aPersistenceExceptionif the key is nullable.- Returns:
trueif this key allows duplicate NULLs (nullable withnullsDistinct = true),falseotherwise.- Since:
- 1.9
- See Also:
-