{"record":{"id":"c4a5dd4ff42fcffb","repo":"hibernate/hibernate-orm","slug":"callback-method-s-annotated-s-in-s-must","errorCode":null,"errorMessage":"Callback method '%s' annotated '@%s' in '%s' must return void and take one argument","messagePattern":"Callback method '(.+?)' annotated '@(.+?)' in '(.+?)' must return void and take one argument","errorType":"exception","errorClass":"ModelsException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/models/spi/LifecycleEventHandler.java","lineNumber":590,"sourceCode":"\t\t\t\t\tlistenerClassDetails,\n\t\t\t\t\tcallbackAnnotation,\n\t\t\t\t\tcallbackType,\n\t\t\t\t\tmethodDetails,\n\t\t\t\t\tcallbackMethods\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate static void applyTargetedAnnotatedCallback(\n\t\t\tClassDetails listenerClassDetails,\n\t\t\tClassDetails targetClassDetails,\n\t\t\tMethodDetails methodDetails,\n\t\t\tClass<? extends Annotation> callbackAnnotation,\n\t\t\tCallbackType callbackType,\n\t\t\tList<LifecycleEventHandler> descriptors) {\n\t\tif ( methodDetails.hasDirectAnnotationUsage( callbackAnnotation ) ) {\n\t\t\tif ( !matchesSignature( JpaEventListenerStyle.LISTENER, methodDetails ) ) {\n\t\t\t\tthrow new ModelsException( \"Callback method '\"\n\t\t\t\t\t\t+ methodDetails.getName() + \"' annotated '@\"\n\t\t\t\t\t\t+ callbackAnnotation.getSimpleName() + \"' in '\"\n\t\t\t\t\t\t+ listenerClassDetails.getClassName() + \"'\"\n\t\t\t\t\t\t+ signatureRequirement( JpaEventListenerStyle.LISTENER ) );\n\t\t\t}\n\t\t\tif ( firstParameterType( methodDetails )\n\t\t\t\t\t.isAssignableFrom( targetClassDetails.toJavaClass() ) ) {\n\t\t\t\taddIfAbsent( listenerClassDetails, callbackType, methodDetails, descriptors );\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static void addIfAbsent(\n\t\t\tClassDetails listenerClassDetails,\n\t\t\tCallbackType callbackType,\n\t\t\tMethodDetails methodDetails,\n\t\t\tList<LifecycleEventHandler> descriptors) {\n\t\tfor ( var existing : descriptors ) {","sourceCodeStart":572,"sourceCodeEnd":608,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/models/spi/LifecycleEventHandler.java#L572-L608","documentation":"Error \"Callback method '%s' annotated '@%s' in '%s' must return void and take one argument\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A JPA entity-listener or lifecycle callback violates the callback contract.","commonSituations":"Listener classes with missing lifecycle annotations, wrong method signatures, or multiple methods for the same event type.","solutions":["Change the callback method signature to void with exactly one parameter (the entity for entity callbacks, or the allowed context type)."],"exampleFix":"Change the callback method signature to void with exactly one parameter (the entity for entity callbacks, or the allowed context type).","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"}