{"record":{"id":"e0c3dcae4952e445","repo":"quarkusio/quarkus","slug":"legacy-setting-being-used-hibernate-ejb-session","errorCode":null,"errorMessage":"Legacy setting being used: 'hibernate.ejb.session_factory_observer' was replaced by '<SESSION_FACTORY_OBSERVER>'. Please update your configuration.","messagePattern":"Legacy setting being used: 'hibernate\\.ejb\\.session_factory_observer' was replaced by '<SESSION_FACTORY_OBSERVER>'\\. Please update your configuration\\.","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"error","filePath":"extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootEntityManagerFactoryBuilder.java","lineNumber":156,"sourceCode":"    }\n\n    private String getExceptionHeader() {\n        return \"[PersistenceUnit: \" + puDescriptor.getName() + \"] \";\n    }\n\n    protected void populate(String persistenceUnitName, SessionFactoryOptionsBuilder options, StandardServiceRegistry ssr) {\n        // will use user override value or default to false if not supplied to follow\n        // JPA spec.\n        final boolean jtaTransactionAccessEnabled = runtimeSettings.getBoolean(\n                org.hibernate.cfg.AvailableSettings.ALLOW_JTA_TRANSACTION_ACCESS);\n        if (!jtaTransactionAccessEnabled) {\n            options.disableJtaTransactionAccess();\n        }\n\n        //Check for use of deprecated org.hibernate.jpa.AvailableSettings.SESSION_FACTORY_OBSERVER\n        final Object legacyObserver = runtimeSettings.get(\"hibernate.ejb.session_factory_observer\");\n        if (legacyObserver != null) {\n            throw new HibernateException(\"Legacy setting being used: 'hibernate.ejb.session_factory_observer' was replaced by '\"\n                    + org.hibernate.cfg.AvailableSettings.SESSION_FACTORY_OBSERVER + \"'. Please update your configuration.\");\n        }\n\n        // Locate and apply any requested SessionFactoryObserver\n        final Object sessionFactoryObserverSetting = runtimeSettings\n                .get(org.hibernate.cfg.AvailableSettings.SESSION_FACTORY_OBSERVER);\n        if (sessionFactoryObserverSetting != null) {\n\n            final StrategySelector strategySelector = ssr.getService(StrategySelector.class);\n            final SessionFactoryObserver suppliedSessionFactoryObserver = strategySelector\n                    .resolveStrategy(SessionFactoryObserver.class, sessionFactoryObserverSetting);\n            options.addSessionFactoryObservers(suppliedSessionFactoryObserver);\n        }\n\n        options.addSessionFactoryObservers(new ServiceRegistryCloser());\n\n        //New in ORM 6.2:\n        options.addSessionFactoryObservers(new SessionFactoryObserverForNamedQueryValidation(metadata));","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootEntityManagerFactoryBuilder.java#L138-L174","documentation":"FastBootEntityManagerFactoryBuilder.populate rejects the deprecated legacy setting 'hibernate.ejb.session_factory_observer', which older Hibernate ORM (4.x) used for attaching SessionFactoryObservers. Quarkus's fast-boot builder throws HibernateException to force migration to the modern org.hibernate.cfg.AvailableSettings.SESSION_FACTORY_OBSERVER key.","triggerScenarios":"A persistence.xml, quarkus.hibernate-orm.persistence-unit.<name>.properties entry, or hibernate.properties still specifies hibernate.ejb.session_factory_observer; a legacy library injects the old key into runtime settings.","commonSituations":"Migrating a legacy Spring/Hibernate 4 config into Quarkus; copy-pasted persistence.xml carrying obsolete hibernate.ejb.* properties.","solutions":["Remove hibernate.ejb.session_factory_observer from persistence.xml/properties.","Register the observer via the modern key org.hibernate.cfg.AvailableSettings.SESSION_FACTORY_OBSERVER (hibernate.session_factory_observer) if truly needed.","Prefer Quarkus-native mechanisms (CDI observers / build-time integration) instead of raw Hibernate observer settings."],"exampleFix":"<!-- before -->\n<property name=\"hibernate.ejb.session_factory_observer\" value=\"com.acme.MyObserver\"/>\n<!-- after -->\n<property name=\"hibernate.session_factory_observer\" value=\"com.acme.MyObserver\"/>","handlingStrategy":"validation","validationCode":"grep -rn \"hibernate.ejb.\" persistence.xml src/main/resources/","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Migrate all hibernate.ejb.* keys to hibernate.* equivalents when moving to Quarkus","Keep persistence.xml minimal; prefer quarkus.hibernate-orm.* config properties","Search dependencies' hibernate.properties for legacy keys"],"tags":["configuration","deprecated-setting","hibernate-orm","migration","session-factory"],"backgroundTag":"deprecated-config-key","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}