quarkusio/quarkus · error · ConfigurationException

Hibernate ORM activated explicitly for persistence unit '<pu

Error message

Hibernate ORM activated explicitly for persistence unit '<puName>', but the Hibernate ORM extension was disabled at build time. If you want Hibernate ORM to be active for this persistence unit, you must set '<enabledPropertyKey>' to 'true' at build time. If you don't want Hibernate ORM to be active for this persistence unit, you must leave '<activePropertyKey>' unset or set it to 'false'.

What it means

When the Hibernate ORM extension is disabled at build time (quarkus.hibernate-orm.enabled=false), a persistence unit may still be explicitly marked active at runtime. HibernateOrmDisabledRecorder.checkNoExplicitActiveTrue detects this contradiction and throws ConfigurationException instructing the developer to either enable the extension at build time or leave active unset/false for that PU.

Source

Thrown at extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/HibernateOrmDisabledRecorder.java:24

import io.quarkus.runtime.annotations.Recorder;
import io.quarkus.runtime.configuration.ConfigurationException;

@Recorder
public class HibernateOrmDisabledRecorder {
    private final RuntimeValue<HibernateOrmRuntimeConfig> runtimeConfig;

    public HibernateOrmDisabledRecorder(final RuntimeValue<HibernateOrmRuntimeConfig> runtimeConfig) {
        this.runtimeConfig = runtimeConfig;
    }

    public void checkNoExplicitActiveTrue() {
        for (var entry : runtimeConfig.getValue().persistenceUnits().entrySet()) {
            var config = entry.getValue();
            if (config.active().isPresent() && config.active().get()) {
                var puName = entry.getKey();
                String enabledPropertyKey = HibernateOrmRuntimeConfig.extensionPropertyKey("enabled");
                String activePropertyKey = HibernateOrmRuntimeConfig.puPropertyKey(puName, "active");
                throw new ConfigurationException(
                        "Hibernate ORM activated explicitly for persistence unit '" + puName
                                + "', but the Hibernate ORM extension was disabled at build time."
                                + " If you want Hibernate ORM to be active for this persistence unit, you must set '"
                                + enabledPropertyKey
                                + "' to 'true' at build time."
                                + " If you don't want Hibernate ORM to be active for this persistence unit, you must leave '"
                                + activePropertyKey
                                + "' unset or set it to 'false'.",
                        Set.of(enabledPropertyKey, activePropertyKey));
            }
        }
    }

}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Set quarkus.hibernate-orm.enabled=true at build time if the PU should be active.
  2. Remove quarkus.hibernate-orm."<pu>".active=true (leave unset or false) if Hibernate should stay disabled.
  3. Audit all profiles so the build-time enabled flag and per-PU active flags are consistent.

Example fix

// before (application.properties)
quarkus.hibernate-orm.enabled=false
quarkus.hibernate-orm."audit".active=true
// after (option A)
quarkus.hibernate-orm.enabled=true
quarkus.hibernate-orm."audit".active=true
// after (option B)
quarkus.hibernate-orm.enabled=false
# leave quarkus.hibernate-orm."audit".active unset or false
Defensive patterns

Strategy: validation

Validate before calling

// via ConfigProvider
var cfg = ConfigProvider.getConfig();
boolean enabled = cfg.getOptionalValue("quarkus.hibernate-orm.enabled", Boolean.class).orElse(true);
boolean puActive = cfg.getOptionalValue("quarkus.hibernate-orm.\"mypu\".active", Boolean.class).orElse(false);
if (!enabled && puActive) {
    throw new IllegalStateException("Extension disabled at build time but PU marked active");
}

Prevention

When it happens

Trigger: checkNoExplicitActiveTrue (called from disableHibernateOrm) iterates persistenceUnits(); for any PU where active().isPresent() && active==true while the extension was disabled at build time, it throws, interpolating the resolved enabledPropertyKey (quarkus.hibernate-orm.enabled) and activePropertyKey (quarkus.hibernate-orm."<pu>".active).

Common situations: Extension disabled via a profile (e.g. %%test) while another profile sets a PU active=true; re-enabling a PU without re-enabling the extension; config inheritance pulling active=true into builds where the extension is off.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/d2b41f68a3aba4dc. Report an issue: GitHub.