hibernate/hibernate-orm · error · IllegalStateException
JpaCompliance is no longer mutable
Error message
JpaCompliance is no longer mutable
What it means
Error "JpaCompliance is no longer mutable" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java:1851
sqlFunctions = new HashMap<>();
}
sqlFunctions.put( registrationName, sqlFunction );
}
public void allowOutOfTransactionUpdateOperations(boolean allow) {
this.allowOutOfTransactionUpdateOperations = allow;
}
public void enableJpaQueryCompliance(boolean enabled) {
mutableJpaCompliance().setQueryCompliance( enabled );
}
private MutableJpaCompliance mutableJpaCompliance() {
if ( jpaCompliance instanceof MutableJpaCompliance mutableJpaCompliance ) {
return mutableJpaCompliance;
}
else {
throw new IllegalStateException( "JpaCompliance is no longer mutable" );
}
}
public void enableJpaTransactionCompliance(boolean enabled) {
mutableJpaCompliance().setTransactionCompliance( enabled );
}
public void enableJpaClosedCompliance(boolean enabled) {
mutableJpaCompliance().setClosedCompliance( enabled );
}
public void enableJpaProxyCompliance(boolean enabled) {
mutableJpaCompliance().setProxyCompliance( enabled );
}
public void enableJpaCachingCompliance(boolean enabled) {
mutableJpaCompliance().setCachingCompliance( enabled );
}View on GitHub (pinned to fad1729dce)
Solutions
- Set JPA compliance options before the SessionFactory is built; they are frozen afterwards.
- Move jpaCompliance configuration into the bootstrap phase (MetadataBuilder/StandardServiceRegistryBuilder settings).
- Remove code that mutates JpaCompliance at runtime.
When it happens
Trigger: Code attempts to change JPA compliance flags after the settings were frozen.
Common situations: Calling SessionFactoryOptionsBuilder compliance setters after the SessionFactory options have been built.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/281d3476d0b94e74.
Report an issue: GitHub.