{"record":{"id":"517aaa3e2196d6fb","repo":"hibernate/hibernate-orm","slug":"key-definition-must-not-be-empty-or-null","errorCode":null,"errorMessage":"Key definition must not be empty or null","messagePattern":"Key definition must not be empty or null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/Page.java","lineNumber":165,"sourceCode":"\tpublic <R> KeyedPage<R> keyedBy(Order<? super R> keyDefinition) {\n\t\tif ( keyDefinition == null )  {\n\t\t\tthrow new IllegalArgumentException(\"Key definition must not null\");\n\t\t}\n\t\treturn new KeyedPage<>( List.of(keyDefinition), this );\n\t}\n\n\t/**\n\t * Obtain a {@linkplain KeyedPage key-based specification} of this page.\n\t *\n\t * @param keyDefinition a list of {@link Order} objects defining a total\n\t *                      order on the result set\n\t * @return a {@link KeyedPage} representing this page\n\t *\n\t * @since 6.5\n\t */\n\tpublic <R> KeyedPage<R> keyedBy(List<Order<? super R>> keyDefinition) {\n\t\tif ( keyDefinition == null || keyDefinition.isEmpty() )  {\n\t\t\tthrow new IllegalArgumentException(\"Key definition must not be empty or null\");\n\t\t}\n\t\treturn new KeyedPage<>( keyDefinition, this );\n\t}\n}\n","sourceCodeStart":147,"sourceCodeEnd":170,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/Page.java#L147-L170","documentation":"Error \"Key definition must not be empty or null\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A runtime precondition of the Hibernate API is violated.","commonSituations":"Occurs when application code or configuration does not satisfy the documented contract of the API being called.","solutions":["Provide a non-empty key definition list for keyset pagination.","Ensure at least one ordering key is supplied."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}