{"record":{"id":"285146dae05d5ae5","repo":"hibernate/hibernate-orm","slug":"persistence-unit-lifecycle-callback-method-not-fou","errorCode":null,"errorMessage":"Persistence unit lifecycle callback method not found: %s (%s)","messagePattern":"Persistence unit lifecycle callback method not found: (.+?) \\((.+?)\\)","errorType":"exception","errorClass":"ModelsException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/models/spi/PersistenceUnitLifecycleEventHandler.java","lineNumber":146,"sourceCode":"\t\t\t@Nonnull PersistenceUnitCallbackType callbackType,\n\t\t\t@Nonnull List<CallbackMethod> callbackMethods) {\n\t\tif ( lifecycleCallback != null ) {\n\t\t\tMethodDetails namedMethod = null;\n\t\t\tfor ( var methodDetails : listenerClassDetails.getMethods() ) {\n\t\t\t\tif ( methodDetails.getName().equals( lifecycleCallback.getMethodName() ) ) {\n\t\t\t\t\tnamedMethod = methodDetails;\n\t\t\t\t\tif ( hasValidSignature( methodDetails ) ) {\n\t\t\t\t\t\tcheckDuplicate( listenerClassDetails, methodDetails, callbackType, callbackMethods );\n\t\t\t\t\t\tcallbackMethods.add( new CallbackMethod( callbackType, methodDetails ) );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( namedMethod != null ) {\n\t\t\t\tvalidateSignature( listenerClassDetails, namedMethod, callbackAnnotation );\n\t\t\t}\n\t\t\tthrow new ModelsException( \"Persistence unit lifecycle callback method not found: \"\n\t\t\t\t\t\t\t\t\t\t+ lifecycleCallback.getMethodName()\n\t\t\t\t\t\t\t\t\t\t+ \" (\" + listenerClassDetails.getClassName() + \")\" );\n\t\t}\n\t}\n\n\tprivate static void validateSignature(\n\t\t\t@Nonnull ClassDetails listenerClassDetails,\n\t\t\t@Nonnull MethodDetails methodDetails,\n\t\t\t@Nonnull Class<? extends Annotation> callbackAnnotation) {\n\t\tif ( !hasValidSignature( methodDetails ) ) {\n\t\t\tthrow new ModelsException( \"Callback method '\"\n\t\t\t\t\t+ methodDetails.getName() + \"' annotated '@\"\n\t\t\t\t\t+ callbackAnnotation.getSimpleName() + \"' in '\"\n\t\t\t\t\t+ listenerClassDetails.getClassName()\n\t\t\t\t\t+ \"' must return void and have one parameter of type 'EntityAgent', 'EntityManager', or 'EntityManagerFactory'\");\n\t\t}\n\t}\n","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/models/spi/PersistenceUnitLifecycleEventHandler.java#L128-L164","documentation":"Error \"Persistence unit lifecycle callback method not found: %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"}