{"record":{"id":"57e8dff7a08b69b5","repo":"hibernate/hibernate-orm","slug":"sqldeleteall-does-not-apply-to-entities-entity","errorCode":null,"errorMessage":"@SQLDeleteAll does not apply to entities: ${entityName}","messagePattern":"@SQLDeleteAll does not apply to entities: (.+?)","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java","lineNumber":1549,"sourceCode":"\t\t\t\tpersistentClass.setUpdateExpectation( getDefaultSupplier( expectationClass ) );\n\t\t\t}\n\t\t}\n\n\t\tvar sqlDelete = resolveCustomSqlAnnotation( annotatedClass, SQLDelete.class, primaryTableName );\n\t\tif ( sqlDelete == null ) {\n\t\t\tsqlDelete = resolveCustomSqlAnnotation( annotatedClass, SQLDelete.class, \"\" );\n\t\t}\n\t\tif ( sqlDelete != null ) {\n\t\t\tpersistentClass.setCustomSQLDelete( sqlDelete.sql().trim(), sqlDelete.callable() );\n\t\t\tfinal var expectationClass = sqlDelete.verify();\n\t\t\tif ( expectationClass != Expectation.class ) {\n\t\t\t\tpersistentClass.setDeleteExpectation( getDefaultSupplier( expectationClass ) );\n\t\t\t}\n\t\t}\n\n\t\tfinal var sqlDeleteAll = resolveCustomSqlAnnotation( annotatedClass, SQLDeleteAll.class, \"\" );\n\t\tif ( sqlDeleteAll != null ) {\n\t\t\tthrow new AnnotationException(\"@SQLDeleteAll does not apply to entities: \"\n\t\t\t\t\t+ persistentClass.getEntityName());\n\t\t}\n\n\t\tfinal var sqlSelect = getOverridableAnnotation( annotatedClass, SQLSelect.class, context );\n\t\tif ( sqlSelect != null ) {\n\t\t\tfinal String loaderName = persistentClass.getEntityName() + \"$SQLSelect\";\n\t\t\tpersistentClass.setLoaderName( loaderName );\n\t\t\tbindNativeQuery( loaderName, sqlSelect, annotatedClass, context );\n\t\t}\n\n\t\tfinal var hqlSelect = annotatedClass.getAnnotationUsage( HQLSelect.class, modelsContext() );\n\t\tif ( hqlSelect != null ) {\n\t\t\tfinal String loaderName = persistentClass.getEntityName() + \"$HQLSelect\";\n\t\t\tpersistentClass.setLoaderName( loaderName );\n\t\t\tbindQuery( loaderName, hqlSelect, context );\n\t\t}\n\t}\n","sourceCodeStart":1531,"sourceCodeEnd":1567,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java#L1531-L1567","documentation":"Error \"@SQLDeleteAll does not apply to entities: ${entityName}\" thrown in hibernate/hibernate-orm.","triggerScenarios":"@SQLDeleteAll is placed on an entity, where it does not apply.","commonSituations":"@SQLDeleteAll used on an @Entity class; it is only valid for collections.","solutions":["Remove @SQLDeleteAll from the entity; it applies only to collections."],"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"}