{"record":{"id":"96659f8efb2c811b","repo":"quarkusio/quarkus","slug":"attempting-to-boot-a-deactivated-hibernate-orm-per","errorCode":null,"errorMessage":"Attempting to boot a deactivated Hibernate ORM persistence unit","messagePattern":"Attempting to boot a deactivated Hibernate ORM persistence unit","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/FastBootHibernatePersistenceProvider.java","lineNumber":211,"sourceCode":"                continue;\n            }\n\n            // See if we (Hibernate) are the persistence provider\n            if (!isProvider(persistenceUnit)) {\n                log.debug(\"Excluding from consideration due to provider mismatch\");\n                continue;\n            }\n\n            RecordedState recordedState = PersistenceUnitsHolder.popRecordedState(persistenceUnitName, false);\n\n            if (recordedState.isReactive()) {\n                throw new IllegalStateException(\n                        \"Attempting to boot a blocking Hibernate ORM instance on a reactive RecordedState\");\n            }\n            final PrevalidatedQuarkusMetadata metadata = recordedState.getMetadata();\n            var puConfig = hibernateOrmRuntimeConfig.persistenceUnits().get(persistenceUnit.getName());\n            if (puConfig.active().isPresent() && !puConfig.active().get()) {\n                throw new IllegalStateException(\n                        \"Attempting to boot a deactivated Hibernate ORM persistence unit\");\n            }\n            RuntimeSettingsResult runtimeSettingsResult = buildRuntimeSettings(persistenceUnitName, recordedState,\n                    puConfig);\n\n            StandardServiceRegistry standardServiceRegistry = rewireMetadataAndExtractServiceRegistry(persistenceUnitName,\n                    recordedState, puConfig, runtimeSettingsResult.settings());\n\n            final Object cdiBeanManager = Arc.container().beanManager();\n            final Object validatorFactory = Arc.container().instance(\"quarkus-hibernate-validator-factory\").get();\n\n            return new FastBootEntityManagerFactoryBuilder(\n                    persistenceUnit,\n                    metadata /* Uses the StandardServiceRegistry references by this! */,\n                    standardServiceRegistry /* Mostly ignored! (yet needs to match) */,\n                    runtimeSettingsResult.settings(),\n                    validatorFactory, cdiBeanManager, recordedState.getMultiTenancyStrategy(),\n                    true,","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/FastBootHibernatePersistenceProvider.java#L193-L229","documentation":"A persistence unit deactivated at runtime via quarkus.hibernate-orm.\"<pu>\".active=false is intentionally not booted. When code still requests its EntityManagerFactory, getEntityManagerFactoryBuilderOrNull throws IllegalStateException('Attempting to boot a deactivated Hibernate ORM persistence unit').","triggerScenarios":"getEntityManagerFactoryBuilderOrNull reads puConfig.active() for the requested PU, finds it present and false, and throws; reached via builder or getEntityManagerFactoryBuilder.","commonSituations":"Named PUs trimmed via active=false but still referenced by code; active flipped by a profile (e.g. %%test) while tests still inject the EM; dynamic activation logic computing active=false incorrectly.","solutions":["Remove active=false (or set it true) for PUs actually used at runtime.","Update code referencing the deactivated PU, or guard it behind configuration checks.","Audit profiles that set active=false and align them with actual usage.","Check HibernateOrmRuntimeConfig/activation state before requesting the factory in custom code."],"exampleFix":"// before (application.properties)\nquarkus.hibernate-orm.\"audit\".active=false\n// after\nquarkus.hibernate-orm.\"audit\".active=true\n// or remove references to the 'audit' PU in code","handlingStrategy":"validation","validationCode":"var cfg = HibernateOrmRuntimeConfigHelper puConfig(\"audit\");\nif (cfg != null && cfg.active().isPresent() && !cfg.active().get()) {\n    throw new IllegalStateException(\"PU 'audit' is deactivated; do not request its EMF\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    emf = bootPu(\"audit\");\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"deactivated Hibernate ORM persistence unit\")) {\n        log.warn(\"PU 'audit' disabled by config; skipping\");\n        emf = null;\n    } else throw e;\n}","preventionTips":["Keep the set of active=false PUs and the code that uses them in sync.","Review profile-specific overrides of quarkus.hibernate-orm.\"pu\".active before releases.","Gate PU-dependent code behind the same activation config."],"tags":["quarkus","hibernate-orm","persistence-unit","deactivated"],"backgroundTag":"persistence-unit-inactive","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"}