{"record":{"id":"b4002418463e0697","repo":"quarkusio/quarkus","slug":"cannot-use-persistence-xml-with-hibernate-reactive","errorCode":null,"errorMessage":"Cannot use persistence.xml with Hibernate Reactive in Quarkus. Must use application.properties instead.","messagePattern":"Cannot use persistence\\.xml with Hibernate Reactive in Quarkus\\. Must use application\\.properties instead\\.","errorType":"exception","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"extensions/hibernate-reactive/deployment/src/main/java/io/quarkus/hibernate/reactive/deployment/HibernateReactiveProcessor.java","lineNumber":124,"sourceCode":"            List<PersistenceUnitDefinitionBuildItem> persistenceUnitDefinitions,\n            List<ReactiveDataSourceBuildItem> reactiveDataSources,\n            ApplicationArchivesBuildItem applicationArchivesBuildItem,\n            LaunchModeBuildItem launchMode,\n            JpaModelPerPersistenceUnitBuildItem jpaModel,\n            Capabilities capabilities,\n            List<SqlLoadScriptDefaultBuildItem> additionalSqlLoadScriptDefaults,\n            BuildProducer<NativeImageResourceBuildItem> nativeImageResources,\n            BuildProducer<HotDeploymentWatchedFileBuildItem> hotDeploymentWatchedFiles,\n            BuildProducer<PersistenceUnitDescriptorBuildItem> persistenceUnitDescriptors,\n            BuildProducer<UnremovableBeanBuildItem> unremovableBeans,\n            List<DatabaseKindDialectBuildItem> dbKindDialectBuildItems) {\n        // Block any reactive persistence units from using persistence.xml\n        for (PersistenceXmlDescriptorBuildItem persistenceXmlDescriptorBuildItem : persistenceXmlDescriptors) {\n            String provider = persistenceXmlDescriptorBuildItem.getDescriptor().getProviderClassName();\n            if (provider == null ||\n                    provider.equals(FastBootHibernateReactivePersistenceProvider.class.getCanonicalName()) ||\n                    provider.equals(FastBootHibernateReactivePersistenceProvider.IMPLEMENTATION_NAME)) {\n                throw new ConfigurationException(\n                        \"Cannot use persistence.xml with Hibernate Reactive in Quarkus. Must use application.properties instead.\");\n            }\n        }\n\n        for (PersistenceUnitDefinitionBuildItem puDefinition : persistenceUnitDefinitions) {\n            if (puDefinition.getParadigm() != ProgrammingParadigm.REACTIVE) {\n                continue;\n            }\n            String puName = puDefinition.getPersistenceUnitName();\n            var model = jpaModel.getModelPerPersistenceUnit().get(puName);\n            if (model == null) {\n                model = new JpaPersistenceUnitModel();\n            }\n\n            buildReactivePersistenceUnitFromConfig(hibernateOrmConfig, puDefinition, model,\n                    reactiveDataSources,\n                    applicationArchivesBuildItem,\n                    launchMode,","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/hibernate-reactive/deployment/src/main/java/io/quarkus/hibernate/reactive/deployment/HibernateReactiveProcessor.java#L106-L142","documentation":"Quarkus Hibernate Reactive does not support configuring persistence units via persistence.xml; all configuration must be in application.properties (quarkus.hibernate-orm.*). During deployment, if a persistence.xml is found whose provider is (or defaults to) the Hibernate Reactive provider, the build fails with this ConfigurationException.","triggerScenarios":"A META-INF/persistence.xml is present in the application, and its provider is null, equals FastBootHibernateReactivePersistenceProvider, or the Quarkus reactive provider canonical name, while Hibernate Reactive is used — detected in HibernateReactiveProcessor.buildReactivePersistenceUnitsFromConfig.","commonSituations":"Migrating a blocking Hibernate app (with persistence.xml) to Hibernate Reactive; reusing a shared persistence.xml inherited from dependencies; IDE scaffolding that generates persistence.xml; forgetting to remove persistence.xml after moving config to application.properties.","solutions":["Delete META-INF/persistence.xml and move all settings to quarkus.hibernate-orm.* properties in application.properties","If persistence.xml comes from a dependency, exclude that jar or the persistence.xml resource","Define named persistence units via quarkus.hibernate-orm.\"puname\".* properties instead of persistence.xml elements","Keep reactive extensions (hibernate-reactive-panache) and remove hibernate-orm blocking deps if migrating"],"exampleFix":"// before (src/main/resources/META-INF/persistence.xml)\n<persistence-unit name=\"default\">\n  <provider>io.quarkus.hibernate.reactive.runtime.FastBootHibernateReactivePersistenceProvider</provider>\n</persistence-unit>\n\n// after (application.properties)\nquarkus.hibernate-orm.database.generation=update\nquarkus.datasource.db-kind=postgresql","handlingStrategy":"validation","validationCode":"if (new File(\"src/main/resources/META-INF/persistence.xml\").exists()) {\n    throw new IllegalStateException(\"Remove persistence.xml; use quarkus.hibernate-orm.* properties\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    quarkusApplication.start(); // build/deployment-time check\n} catch (ConfigurationException e) {\n    if (e.getMessage().contains(\"persistence.xml\")) { migrateToProperties(); }\n    throw e;\n}","preventionTips":["Do not include persistence.xml in Quarkus (blocking or reactive) applications","Exclude transitive jars that ship persistence.xml","Use quarkus.hibernate-orm.\"pu\".* properties as the single config source"],"tags":["build-time","hibernate-reactive","persistence-xml","configuration-exception"],"backgroundTag":"persistence-xml-unsupported","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"}