{"record":{"id":"499653fe6ea01b04","repo":"hibernate/hibernate-orm","slug":"event-listener-must-implement","errorCode":null,"errorMessage":"Event listener '{}' must implement '{}'","messagePattern":"Event listener '(.+?)' must implement '(.+?)'","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataImpl.java","lineNumber":516,"sourceCode":"\t\t\t\tfinal String eventTypeName = propertyName.substring( EVENT_LISTENER_PREFIX.length() + 1 );\n\t\t\t\tfinal var eventType = EventType.resolveEventTypeByName( eventTypeName );\n\t\t\t\tfinal String listeners = (String) value;\n\t\t\t\tappendListeners( eventListenerRegistry, classLoaderService, listeners, eventType );\n\t\t\t}\n\t\t} );\n\t}\n\n\tprivate <T> void appendListeners(\n\t\t\tEventListenerRegistry eventListenerRegistry,\n\t\t\tClassLoaderService classLoaderService,\n\t\t\tString listeners,\n\t\t\tEventType<T> eventType) {\n\t\tfinal var eventListenerGroup = eventListenerRegistry.getEventListenerGroup( eventType );\n\t\tfor ( String listenerImpl : splitAtCommas( listeners ) ) {\n\t\t\tfinal var listener = instantiate( listenerImpl, classLoaderService );\n\t\t\tfinal var baseListenerInterface = eventType.baseListenerInterface();\n\t\t\tif ( !baseListenerInterface.isInstance( listener ) ) {\n\t\t\t\tthrow new HibernateException( \"Event listener '\" + listenerImpl\n\t\t\t\t\t\t+ \"' must implement '\" + baseListenerInterface.getName() + \"'\");\n\t\t\t}\n\t\t\teventListenerGroup.appendListener( baseListenerInterface.cast( listener ) );\n\t\t}\n\t}\n\n\tprivate static Object instantiate(String listenerImpl, ClassLoaderService classLoaderService) {\n\t\ttry {\n\t\t\treturn classLoaderService.classForName( listenerImpl ).newInstance();\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tthrow new HibernateException( \"Could not instantiate event listener '\" + listenerImpl + \"'\", e );\n\t\t}\n\t}\n\n\t@Override\n\tpublic void visitRegisteredComponents(Consumer<Component> consumer) {\n\t\tcomposites.forEach( consumer );","sourceCodeStart":498,"sourceCodeEnd":534,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataImpl.java#L498-L534","documentation":"Error \"Event listener '{}' must implement '{}'\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A configured event listener class does not implement the required listener interface.","commonSituations":"Registering a listener for an event type (e.g. PreInsertEventListener) whose class does not implement that interface.","solutions":["Make the listener class implement the expected Hibernate event listener interface (e.g. PreInsertEventListener).","Register the listener under the correct event type that matches the interfaces it implements.","Check for classloading issues where the listener was compiled against a different Hibernate version."],"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"}