{"record":{"id":"9fe585c8ab49490d","repo":"hibernate/hibernate-orm","slug":"empty-selections-passed-to-criteria-query-typed-as-9fe585","errorCode":null,"errorMessage":"empty selections passed to criteria query typed as Object","messagePattern":"empty selections passed to criteria query typed as Object","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/sqm/tree/spi/select/SqmSelectStatement.java","lineNumber":380,"sourceCode":"\n\t@Nonnull\n\t@Override @Deprecated\n\tpublic SqmSelectStatement<T> multiselect(@Nonnull List<Selection<?>> selectionList) {\n\t\tif ( nodeBuilder().isJpaQueryComplianceEnabled() ) {\n\t\t\tfor ( Selection<?> selection : selectionList ) {\n\t\t\t\tcheckSelectionIsJpaCompliant( selection );\n\t\t\t}\n\t\t}\n\t\tgetQuerySpec().getSelectClause()\n\t\t\t\t.setSelection( (SqmSelectableNode<?>) getResultSelection( selectionList ) );\n\t\treturn this;\n\t}\n\n\tprivate JpaSelection<?> getResultSelection(List<Selection<?>> selections) {\n\t\tfinal Class<T> resultType = getResultType();\n\t\tif ( resultType == Object.class ) {\n\t\t\treturn switch ( selections.size() ) {\n\t\t\t\tcase 0 -> throw new IllegalArgumentException(\n\t\t\t\t\t\t\"empty selections passed to criteria query typed as Object\" );\n\t\t\t\tcase 1 -> (JpaSelection<?>) selections.get( 0 );\n\t\t\t\tdefault -> nodeBuilder().array( selections );\n\t\t\t};\n\t\t}\n\t\telse if ( Tuple.class.isAssignableFrom( resultType ) ) {\n\t\t\treturn nodeBuilder().tuple( selections );\n\t\t}\n\t\telse if ( resultType.isArray() ) {\n\t\t\treturn nodeBuilder().array( resultType, selections );\n\t\t}\n\t\telse {\n\t\t\treturn nodeBuilder().construct( resultType, selections );\n\t\t}\n\t}\n\n\tprivate void checkSelectionIsJpaCompliant(Selection<?> selection) {\n\t\tif ( selection instanceof SqmSubQuery<?> ) {","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/spi/select/SqmSelectStatement.java#L362-L398","documentation":"Error \"empty selections passed to criteria query typed as Object\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A select statement typed as Object is given an empty selection list.","commonSituations":"Empty multiselect on an Object-typed query; supply selections or use Object[].class.","solutions":["Provide at least one selection to the criteria query (e.g. select(root) or multiselect(...)).","If a compound result is intended, type the query as Tuple/Object[] and supply multiple selections.","Guard dynamic selection-list building so an empty list is never passed."],"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"}