{"record":{"id":"675142593bcdc3cf","repo":"hibernate/hibernate-orm","slug":"path-may-not-be-empty-675142","errorCode":null,"errorMessage":"Path may not be empty","messagePattern":"Path may not be empty","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/restriction/JakartaDataRestriction.java","lineNumber":166,"sourceCode":"\t\t\tCriteriaQuery<?> query,\n\t\t\tRoot<?> root,\n\t\t\tCriteriaBuilder builder) {\n\t\trequireNonNull( sort, \"missing sort\" );\n\t\trequireNonNull( query, \"missing query\" );\n\t\trequireNonNull( root, \"missing root\" );\n\t\trequireNonNull( builder, \"missing builder\" );\n\t\tfinal var expression =\n\t\t\t\tsort.ignoreCase()\n\t\t\t\t\t\t? builder.lower( path( root, sort.property() ).as( String.class ) )\n\t\t\t\t\t\t: path( root, sort.property() );\n\t\tappendOrder( query, sort.isDescending() ? builder.desc( expression ) : builder.asc( expression ) );\n\t}\n\n\tprivate static jakarta.persistence.criteria.Path<?> path(Root<?> root, String path) {\n\t\trequireNonNull( path, \"missing path\" );\n\t\tfinal var tokens = new StringTokenizer( path, \".\" );\n\t\tif ( !tokens.hasMoreTokens() ) {\n\t\t\tthrow new IllegalArgumentException( \"Path may not be empty\" );\n\t\t}\n\t\tjakarta.persistence.criteria.Path<?> criteriaPath = root;\n\t\twhile ( tokens.hasMoreTokens() ) {\n\t\t\tcriteriaPath = criteriaPath.get( tokens.nextToken() );\n\t\t}\n\t\treturn criteriaPath;\n\t}\n\n\tprivate static void appendOrder(CriteriaQuery<?> query, jakarta.persistence.criteria.Order order) {\n\t\tfinal List<jakarta.persistence.criteria.Order> orders = new ArrayList<>( query.getOrderList() );\n\t\torders.add( order );\n\t\tquery.orderBy( orders );\n\t}\n\n\t/**\n\t * Obtain a {@linkplain Predicate JPA criteria predicate} representing the given\n\t * {@linkplain jakarta.data.restrict.Restriction Jakarta Data restriction}.\n\t */","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/restriction/JakartaDataRestriction.java#L148-L184","documentation":"Error \"Path may not be empty\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A Jakarta Data restriction is invalid or unsupported: Path may not be empty","commonSituations":"Building Restrictions with empty paths, unsupported restriction/constraint/expression types, or expressions of the wrong Java type.","solutions":["The restriction path is empty. Provide a non-empty attribute path for the restriction."],"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"}