{"record":{"id":"3029a64f999f90e1","repo":"hibernate/hibernate-orm","slug":"callback-method-s-s-s-in-s-s","errorCode":null,"errorMessage":"Callback method '%s' %s '@%s' in '%s'%s","messagePattern":"Callback method '(.+?)' (.+?) '@(.+?)' in '(.+?)'(.+?)","errorType":"exception","errorClass":"ModelsException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/models/spi/LifecycleEventHandler.java","lineNumber":686,"sourceCode":"\t\t\t\tlistenerClassDetails,\n\t\t\t\tcallbackAnnotation,\n\t\t\t\tcallbackType,\n\t\t\t\tmethodDetails,\n\t\t\t\tcallbackMethods,\n\t\t\t\t\"annotated\"\n\t\t);\n\t}\n\n\tprivate static void setCallbackMethod(\n\t\t\tJpaEventListenerStyle consumerType,\n\t\t\tClassDetails listenerClassDetails,\n\t\t\tClass<? extends Annotation> callbackAnnotation,\n\t\t\tCallbackType callbackType,\n\t\t\tMethodDetails methodDetails,\n\t\t\tMap<CallbackType, MethodDetails> callbackMethods,\n\t\t\tString source) {\n\t\tif ( !matchesSignature( consumerType, methodDetails ) ) {\n\t\t\tthrow new ModelsException( \"Callback method '\"\n\t\t\t\t\t+ methodDetails.getName() + \"' \" + source + \" '@\"\n\t\t\t\t\t+ callbackAnnotation.getSimpleName() + \"' in '\"\n\t\t\t\t\t+ listenerClassDetails.getClassName() + \"'\"\n\t\t\t\t\t+ signatureRequirement( consumerType ) );\n\t\t}\n\t\tif ( callbackMethods.containsKey( callbackType ) ) {\n\t\t\tthrow new ModelsException( \"Duplicate callback method \" + source + \" '@\"\n\t\t\t\t\t+ callbackAnnotation.getSimpleName() + \"' in listener class '\"\n\t\t\t\t\t+ listenerClassDetails.getClassName() + \"'\" );\n\t\t}\n\t\tcallbackMethods.put( callbackType, methodDetails );\n\t}\n\n\tprivate static String signatureRequirement(JpaEventListenerStyle consumerType) {\n\t\treturn switch ( consumerType ) {\n\t\t\tcase CALLBACK -> \" must return void and take no arguments\";\n\t\t\tcase LISTENER -> \" must return void and take one argument\";\n\t\t};","sourceCodeStart":668,"sourceCodeEnd":704,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/models/spi/LifecycleEventHandler.java#L668-L704","documentation":"Error \"Callback method '%s' %s '@%s' in '%s'%s\" 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":["Ensure the named callback method exists on the listener class with the required signature (void return, correct single parameter, accessible)."],"exampleFix":"Ensure the named callback method exists on the listener class with the required signature (void return, correct single parameter, accessible).","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"}