{"record":{"id":"281d3476d0b94e74","repo":"hibernate/hibernate-orm","slug":"jpacompliance-is-no-longer-mutable","errorCode":null,"errorMessage":"JpaCompliance is no longer mutable","messagePattern":"JpaCompliance is no longer mutable","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java","lineNumber":1851,"sourceCode":"\t\t\tsqlFunctions = new HashMap<>();\n\t\t}\n\t\tsqlFunctions.put( registrationName, sqlFunction );\n\t}\n\n\tpublic void allowOutOfTransactionUpdateOperations(boolean allow) {\n\t\tthis.allowOutOfTransactionUpdateOperations = allow;\n\t}\n\n\tpublic void enableJpaQueryCompliance(boolean enabled) {\n\t\tmutableJpaCompliance().setQueryCompliance( enabled );\n\t}\n\n\tprivate MutableJpaCompliance mutableJpaCompliance() {\n\t\tif ( jpaCompliance instanceof MutableJpaCompliance mutableJpaCompliance ) {\n\t\t\treturn mutableJpaCompliance;\n\t\t}\n\t\telse {\n\t\t\tthrow new IllegalStateException( \"JpaCompliance is no longer mutable\" );\n\t\t}\n\t}\n\n\tpublic void enableJpaTransactionCompliance(boolean enabled) {\n\t\tmutableJpaCompliance().setTransactionCompliance( enabled );\n\t}\n\n\tpublic void enableJpaClosedCompliance(boolean enabled) {\n\t\tmutableJpaCompliance().setClosedCompliance( enabled );\n\t}\n\n\tpublic void enableJpaProxyCompliance(boolean enabled) {\n\t\tmutableJpaCompliance().setProxyCompliance( enabled );\n\t}\n\n\tpublic void enableJpaCachingCompliance(boolean enabled) {\n\t\tmutableJpaCompliance().setCachingCompliance( enabled );\n\t}","sourceCodeStart":1833,"sourceCodeEnd":1869,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java#L1833-L1869","documentation":"Error \"JpaCompliance is no longer mutable\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Code attempts to change JPA compliance flags after the settings were frozen.","commonSituations":"Calling SessionFactoryOptionsBuilder compliance setters after the SessionFactory options have been built.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}