{"record":{"id":"d730b39910ed9b5c","repo":"hibernate/hibernate-orm","slug":"unable-to-locate-proper-event-type-for-event-name","errorCode":null,"errorMessage":"Unable to locate proper event type for event name [","messagePattern":"Unable to locate proper event type for event name \\[","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/event/spi/EventType.java","lineNumber":125,"sourceCode":"\t}\n\n\t/**\n\t * Find an {@link EventType} by its name\n\t *\n\t * @param eventName The name\n\t *\n\t * @return The {@link EventType} instance.\n\t *\n\t * @throws HibernateException If eventName is null, or if eventName does not correlate to any known event type.\n\t */\n\t@Nonnull\n\tpublic static EventType<?> resolveEventTypeByName(@Nonnull final String eventName) {\n\t\tif ( eventName == null ) {\n\t\t\tthrow new HibernateException( \"event name to resolve cannot be null\" );\n\t\t}\n\t\tfinal EventType<?> eventType = STANDARD_TYPE_BY_NAME_MAP.get( eventName );\n\t\tif ( eventType == null ) {\n\t\t\tthrow new HibernateException( \"Unable to locate proper event type for event name [\" + eventName + \"]\" );\n\t\t}\n\t\treturn eventType;\n\t}\n\n\t/**\n\t * Get a collection of all the standard {@link EventType} instances.\n\t */\n\t@Nonnull\n\tpublic static Collection<EventType<?>> values() {\n\t\treturn STANDARD_TYPE_BY_NAME_MAP.values();\n\t}\n\n\t/**\n\t * Used from {@link EventEngine} to \"prime\" the registered event-type map.\n\t *\n\t * Simply copy the values into its (passed) Map\n\t */\n\tstatic void registerStandardTypes(@Nonnull Map<String, EventType<?>> eventTypes) {","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/event/spi/EventType.java#L107-L143","documentation":"HibernateException from EventType.resolveEventTypeByName when the name is non-null but absent from STANDARD_TYPE_BY_NAME_MAP — the map covers only the built-in EventType constants, not custom event types contributed through the EventEngine. The unknown name is echoed in the message; the exception means the string simply does not name any standard Hibernate event.","triggerScenarios":"A typo in an event name string — e.g. hibernate.cfg.xml <event type='loads'>, 'save-update' variants that no longer exist, or programmatic registry lookups by name; using resolveEventTypeByName for a custom event type that was contributed via EventEngineContributor (it will never be found here).","commonSituations":"Upgrading Hibernate across major versions where event names were added/removed/renamed; XML configs copied from old projects or blog posts; integrations resolving names from external config files that drift from the code's actual event types.","solutions":["Use an exact standard name from EventType's constants: auto-flush, create, delete, dirty-check, evict, flush, flush-entity, load, load-collection, lock, merge, persist, refresh, replicate, save, save-update, pre-collection-*, post-* (check the EventType source for the authoritative list)","For custom event types resolve via the SessionFactory's EventEngine: factory.getEventEngine().findRegisteredEventType(name)","Validate event-name strings at startup against EventType.values()/getRegisteredEventTypes() so typos fail fast with a list of valid names"],"exampleFix":"// before\nEventType<?> t = EventType.resolveEventTypeByName(\"loads\"); // typo -> Unable to locate proper event type for event name [loads]\n\n// after\nEventType<?> t = EventType.resolveEventTypeByName(\"load\");","handlingStrategy":"validation","validationCode":"Set<String> valid = EventType.values().stream()\n        .map(EventType::eventName).collect(Collectors.toSet());\nif (!valid.contains(configuredName)) {\n    throw new IllegalArgumentException(\"Unknown event type '\" + configuredName + \"'; valid: \" + valid);\n}\nEventType<?> t = EventType.resolveEventTypeByName(configuredName);","typeGuard":"boolean isKnownEventName(String name) {\n    return EventType.values().stream().anyMatch(t -> t.eventName().equals(name));\n}","tryCatchPattern":"try {\n    EventType<?> t = EventType.resolveEventTypeByName(name);\n} catch (HibernateException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Unable to locate proper event type\")) {\n        // log valid names and fail config validation with a helpful message\n    }\n    throw e;\n}","preventionTips":["Validate event-name strings against EventType.values() at startup and list valid options on failure","After major Hibernate upgrades, re-check that every configured event name still exists","For custom event types use EventEngine.findRegisteredEventType, not resolveEventTypeByName"],"tags":["hibernate","event-type","configuration","typo","version-upgrade"],"backgroundTag":"unknown-config-name","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}