{"record":{"id":"cdda280dc0453292","repo":"hibernate/hibernate-orm","slug":"multiple-callback-methods-for-callback-type-s","errorCode":null,"errorMessage":"Multiple callback methods for callback type '@%s' and parameter type '%s' in listener class '%s'","messagePattern":"Multiple callback methods for callback type '@(.+?)' and parameter type '(.+?)' in listener class '(.+?)'","errorType":"exception","errorClass":"ModelsException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/models/spi/LifecycleEventHandler.java","lineNumber":612,"sourceCode":"\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 ) {\n\t\t\tfinal var existingMethod = existing.getCallbackMethod( callbackType );\n\t\t\tif ( existingMethod != null && existingMethod != methodDetails\n\t\t\t\t\t&& Objects.equals( firstParameterType( existingMethod ), firstParameterType( methodDetails ) ) ) {\n\t\t\t\tthrow new ModelsException(\n\t\t\t\t\t\t\"Multiple callback methods for callback type '@\"\n\t\t\t\t\t\t+ callbackType.getCallbackAnnotation().getSimpleName()\n\t\t\t\t\t\t+ \"' and parameter type '\" + firstParameterType( methodDetails ).getSimpleName()\n\t\t\t\t\t\t+ \"' in listener class '\" + listenerClassDetails.getClassName() + \"'\" );\n\t\t\t}\n\t\t}\n\t\tdescriptors.add( withCallbackMethod( listenerClassDetails, callbackType, methodDetails ) );\n\t}\n\n\tprivate static Class<?> firstParameterType(MethodDetails first) {\n\t\treturn first.getArgumentTypes().get( 0 ).toJavaClass();\n\t}\n\n\tprivate static LifecycleEventHandler withCallbackMethod(\n\t\t\tClassDetails listenerClassDetails,\n\t\t\tCallbackType callbackType,\n\t\t\tMethodDetails methodDetails) {\n\t\tfinal EnumMap<CallbackType, MethodDetails> callbackMethods = new EnumMap<>( CallbackType.class );","sourceCodeStart":594,"sourceCodeEnd":630,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/models/spi/LifecycleEventHandler.java#L594-L630","documentation":"Error \"Multiple callback methods for callback type '@%s' and parameter type '%s' in listener class '%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":["Keep a single callback method per lifecycle event type (and parameter type) in the listener/callback class; merge the logic of the duplicates."],"exampleFix":"Keep a single callback method per lifecycle event type (and parameter type) in the listener/callback class; merge the logic of the duplicates.","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"}