hibernate/hibernate-orm · error · IllegalArgumentException
Key definition must not null
Error message
Key definition must not null
What it means
Error "Key definition must not null" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/Page.java:149
return new Page( size, number-1 );
}
public Page first() {
return first( size );
}
/**
* Obtain a {@linkplain KeyedPage key-based specification} of this page.
*
* @param keyDefinition an {@link Order} object defining a total order
* on the result set
* @return a {@link KeyedPage} representing this page
*
* @since 6.5
*/
public <R> KeyedPage<R> keyedBy(Order<? super R> keyDefinition) {
if ( keyDefinition == null ) {
throw new IllegalArgumentException("Key definition must not null");
}
return new KeyedPage<>( List.of(keyDefinition), this );
}
/**
* Obtain a {@linkplain KeyedPage key-based specification} of this page.
*
* @param keyDefinition a list of {@link Order} objects defining a total
* order on the result set
* @return a {@link KeyedPage} representing this page
*
* @since 6.5
*/
public <R> KeyedPage<R> keyedBy(List<Order<? super R>> keyDefinition) {
if ( keyDefinition == null || keyDefinition.isEmpty() ) {
throw new IllegalArgumentException("Key definition must not be empty or null");
}
return new KeyedPage<>( keyDefinition, this );View on GitHub (pinned to fad1729dce)
Solutions
- Provide a non-null key definition for keyset pagination.
- Build the Page with a valid key reference.
When it happens
Trigger: A runtime precondition of the Hibernate API is violated.
Common situations: Occurs when application code or configuration does not satisfy the documented contract of the API being called.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/902a484414e254ec.
Report an issue: GitHub.