Skip to content

Update MergePersistenceUnitManager and JPA persistence infrastructure for Hibernate 6#8

Open
devin-ai-integration[bot] wants to merge 2 commits intodevelop-7.0.xfrom
devin/ticket-1.4-merge-persistence-unit-manager
Open

Update MergePersistenceUnitManager and JPA persistence infrastructure for Hibernate 6#8
devin-ai-integration[bot] wants to merge 2 commits intodevelop-7.0.xfrom
devin/ticket-1.4-merge-persistence-unit-manager

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented Apr 17, 2026

Overview

Migrates the JPA persistence infrastructure from Hibernate 5.6.15.Final to Hibernate 6.4.10.Final. This is part of the broader Hibernate 6 / Spring 6 migration effort. The MergePersistenceUnitManager, BroadleafCommonConfig, and BroadleafHibernateEnhancingClassTransformerImpl were audited and found to be compatible with Hibernate 6 / Spring 6 APIs without code changes.

Labels: Enhancement, Status: ready-for-code-review

Changes

POM dependency updates (pom.xml, common/pom.xml):

  • Hibernate version: 5.6.15.Final6.4.10.Final
  • GroupId: org.hibernateorg.hibernate.orm
  • Artifact names: removed -jakarta suffix (hibernate-core-jakartahibernate-core, hibernate-envers-jakartahibernate-envers)
  • Removed obsolete exclusions (javax.persistence-api, javax.el-api, org.osgi.core, self-referential hibernate-core from hibernate-jcache)

JCache property namespace migration (JCachePersistenceUnitPostProcessor.java, DefaultJCacheUriProvider.java):

  • All hibernate.javax.cache.*hibernate.jakarta.cache.* in @Value annotations, property setters, log messages, and Javadoc

Persistence XML updates (5 files across common, admin, core modules):

  • XML namespace updated from JPA 2.0 (http://java.sun.com/xml/ns/persistence) to JPA 3.0 (https://jakarta.ee/xml/ns/persistence)
  • hibernate.javax.cache.providerhibernate.jakarta.cache.provider
  • hibernate.cache.region.factory_class updated from org.hibernate.cache.jcache.JCacheRegionFactory to org.hibernate.cache.jcache.internal.JCacheRegionFactory (class relocated in Hibernate 6)
  • hibernate.ejb.session_factory_observerhibernate.session_factory_observer in persistence-open-admin.xml (the hibernate.ejb.* prefix was removed in Hibernate 6)
  • Removed deprecated properties: hibernate.id.new_generator_mappings and hibernate.id.optimizer.pooled.prefer_lo (these are the default behavior in Hibernate 6 and the settings are no longer recognized)

Compilation verified with mvn compile -DskipTests -pl common --also-make — BUILD SUCCESS.

Human Review Checklist

  • Deprecated property removal: hibernate.id.new_generator_mappings and hibernate.id.optimizer.pooled.prefer_lo were removed from all persistence XMLs. Hibernate 6 defaults to the "new" generator behavior. Verify this won't cause ID generation mismatches against existing database sequences.
  • SessionFactoryChangeListener compatibility: The property was renamed from hibernate.ejb.session_factory_observer to hibernate.session_factory_observer, but SessionFactoryChangeListener itself was not modified. Verify it still implements the correct SessionFactoryObserver interface expected by Hibernate 6.
  • JCacheRegionFactory internal path: The class moved to org.hibernate.cache.jcache.internal.JCacheRegionFactory — the internal package suggests this is not public API. Consider whether using the short name jcache is more future-proof.
  • Test persistence XMLs not updated: persistence-common-test.xml and persistence-test.xml (in integration/) still have the old JPA 2.0 namespace and deprecated properties — confirm whether those also need updating or are intentionally left for a separate pass.
  • Downstream config impact: Any external configs (e.g., in downstream Broadleaf sites) using hibernate.javax.cache.* property names will need to be updated to hibernate.jakarta.cache.* to continue taking effect.
  • Exclusion removal from hibernate-core: Old exclusions for javax.persistence-api, javax.el-api, org.osgi.core were removed since Hibernate 6 no longer ships these transitive deps. Verify no classpath conflicts arise.
  • Full module compilation: Only common module was compile-verified. Other modules (admin, core, framework) may surface additional Hibernate 6 API breaks in their own source files.

Link to Devin session: https://app.devin.ai/sessions/46c3dcf6ddb14c178628da21e9fe2eab
Requested by: @Colhodm


Open with Devin

- Update Hibernate from 5.6.15.Final to 6.4.10.Final
- Change groupId from org.hibernate to org.hibernate.orm
- Update artifact names: remove -jakarta suffix (hibernate-core-jakarta -> hibernate-core, etc.)
- Update JCache property namespace: hibernate.javax.cache.* -> hibernate.jakarta.cache.*
- Update persistence XML namespace to jakarta.ee JPA 3.0
- Remove deprecated Hibernate properties (hibernate.id.new_generator_mappings, hibernate.id.optimizer.pooled.prefer_lo)
- Verified MergePersistenceUnitManager, BroadleafCommonConfig, and BroadleafHibernateEnhancingClassTransformerImpl are compatible with Hibernate 6 / Spring 6 APIs

Co-Authored-By: Arjun Mishra <arjunsaxmishra@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration[bot]

This comment was marked as resolved.

…n_factory_observer property

- Update hibernate.cache.region.factory_class from org.hibernate.cache.jcache.JCacheRegionFactory to org.hibernate.cache.jcache.internal.JCacheRegionFactory (class moved in Hibernate 6)
- Rename hibernate.ejb.session_factory_observer to hibernate.session_factory_observer (hibernate.ejb.* prefix removed in Hibernate 6)

Co-Authored-By: Arjun Mishra <arjunsaxmishra@gmail.com>
@devin-ai-integration devin-ai-integration Bot changed the title TICKET 1.4: Update MergePersistenceUnitManager for Hibernate 6 Update MergePersistenceUnitManager and JPA persistence infrastructure for Hibernate 6 Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant