Skip to content

Ticket 1.2: Update persistence.xml files for Hibernate 6 compatibility#1

Open
devin-ai-integration[bot] wants to merge 1 commit intodevelop-7.0.xfrom
devin/ticket-1.2-persistence-xml-hibernate6
Open

Ticket 1.2: Update persistence.xml files for Hibernate 6 compatibility#1
devin-ai-integration[bot] wants to merge 1 commit intodevelop-7.0.xfrom
devin/ticket-1.2-persistence-xml-hibernate6

Conversation

@devin-ai-integration
Copy link
Copy Markdown

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

Brief Overview

Migrates all 7 persistence XML files from JPA 2.0 / Hibernate 5.x configuration to Jakarta Persistence 3.0 / Hibernate 6 as part of the Hibernate 6 upgrade effort.

Changes

Applied across all 7 files:

  • XML namespace: http://java.sun.com/xml/ns/persistencehttps://jakarta.ee/xml/ns/persistence
  • Persistence version: 2.03.0
  • Schema location: updated to persistence_3_0.xsd
  • Removed hibernate.dialect (Hibernate 6 auto-detects from JDBC URL)
  • Removed hibernate.id.new_generator_mappings (always-on in Hibernate 6)

Property renames:

  • hibernate.javax.cache.providerhibernate.jakarta.cache.provider (in persistence-common.xml, persistence-cms.xml)
  • hibernate.ejb.session_factory_observerhibernate.session_factory_observer (in persistence-open-admin.xml)

Removed deprecated properties:

  • hibernate.enable_lazy_load_no_trans removed from all 3 persistence units in persistence-test.xml (property no longer exists in Hibernate 6)

Files Changed

  • common/src/main/resources/META-INF/persistence-common.xml
  • core/broadleaf-profile/src/main/resources/META-INF/persistence-profile.xml
  • core/broadleaf-framework/src/main/resources/META-INF/persistence-framework.xml
  • admin/broadleaf-open-admin-platform/src/main/resources/META-INF/persistence-open-admin.xml
  • admin/broadleaf-contentmanagement-module/src/main/resources/META-INF/persistence-cms.xml
  • common/src/test/resources/META-INF/persistence-common-test.xml
  • integration/src/test/resources/META-INF/persistence-test.xml

No Java source code was modified.

Labels

  • Enhancement
  • Status: ready-for-code-review

Human Review Checklist

  • hibernate.session_factory_observer rename (persistence-open-admin.xml): Verify that SessionFactoryChangeListener implements the Hibernate 6 SessionFactoryObserver interface correctly — the property key changed from hibernate.ejb.session_factory_observer.
  • Dialect auto-detection in tests: All files had HSQLDialect hardcoded; removal relies on Hibernate 6 inferring the dialect from the JDBC URL. Confirm HSQLDB test data sources provide a recognizable URL.
  • hibernate.enable_lazy_load_no_trans removal (persistence-test.xml): This property no longer exists in Hibernate 6. Verify integration tests don't depend on lazy-loading outside a transaction context.
  • hibernate.cache.region.factory_class still references org.hibernate.cache.jcache.JCacheRegionFactory — consider whether the Hibernate 6 class path (org.hibernate.cache.jcache.internal.JCacheRegionFactory) is required or if the old name still resolves.

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


Open with Devin

- Update XML namespace from javax to Jakarta EE (https://jakarta.ee/xml/ns/persistence)
- Update persistence version from 2.0 to 3.0
- Update schema location to persistence_3_0.xsd
- Remove hibernate.id.new_generator_mappings (always true in Hibernate 6)
- Change hibernate.javax.cache.provider to hibernate.jakarta.cache.provider
- Remove explicit hibernate.dialect (Hibernate 6 auto-detects dialect)
- Update hibernate.ejb.session_factory_observer to hibernate.session_factory_observer
- Remove hibernate.enable_lazy_load_no_trans (removed in Hibernate 6)

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

Copy link
Copy Markdown
Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

<property name="hibernate.transaction.flush_before_completion" value="false"/>
<property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.jcache.JCacheRegionFactory"/>
<property name="hibernate.javax.cache.provider" value="org.ehcache.jsr107.EhcacheCachingProvider"/>
<property name="hibernate.jakarta.cache.provider" value="org.ehcache.jsr107.EhcacheCachingProvider"/>
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Incomplete javax→jakarta migration: JCachePersistenceUnitPostProcessor still sets old hibernate.javax.cache.* property names

The persistence XML files were updated to use the new hibernate.jakarta.cache.provider property name (JPA 3.0 / Hibernate 6), but JCachePersistenceUnitPostProcessor.java:71 still sets hibernate.javax.cache.uri and JCachePersistenceUnitPostProcessor.java:78 still sets hibernate.javax.cache.provider programmatically on the persistence unit. In Hibernate 6 (required for JPA 3.0), these old property names are not recognized, so the programmatic JCache configuration (cache URI and cache provider override) will silently have no effect. The XML's hibernate.jakarta.cache.provider value will also coexist with a stale hibernate.javax.cache.provider key set by the post-processor, causing confusion.

Prompt for agents
The persistence XML files were updated from hibernate.javax.cache.provider to hibernate.jakarta.cache.provider, but the Java code in JCachePersistenceUnitPostProcessor (common/src/main/java/org/broadleafcommerce/common/extensibility/jpa/JCachePersistenceUnitPostProcessor.java) was not updated to match. Specifically:

1. Line 71: properties.setProperty("hibernate.javax.cache.uri", ...) should use "hibernate.jakarta.cache.uri"
2. Line 78: properties.setProperty("hibernate.javax.cache.provider", cacheProvider) should use "hibernate.jakarta.cache.provider"
3. Line 49: The @Value annotation reads from the Spring property hibernate.javax.cache.provider — consider updating the Spring property name too for consistency, or add a note that this is a Spring-level property name.

Additionally, DefaultJCacheUriProvider.java (common/src/main/java/org/broadleafcommerce/common/extensibility/cache/DefaultJCacheUriProvider.java) has:
1. Line 37: @Value("${hibernate.javax.cache.uri:#{null}}") — same Spring-level naming concern
2. Line 40: @Value("${hibernate.javax.cache.uri.relative:true}") — same concern
3. Lines 54 and 58: Log/error messages referencing the old property names

All hibernate.javax.cache.* property keys set on the Hibernate persistence unit must be updated to hibernate.jakarta.cache.* to be recognized by Hibernate 6.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — confirmed that JCachePersistenceUnitPostProcessor.java (lines 71, 78) and DefaultJCacheUriProvider.java (lines 37, 40, 54, 58) still reference the old hibernate.javax.cache.* property names.

However, this PR is scoped to XML configuration files only per the ticket constraints ("Do NOT change Java source code — only XML configuration files"). The Java-side javax→jakarta migration for these cache properties should be addressed in a separate ticket covering the Java source code migration.

I've verified the specific lines that will need updating:

  • JCachePersistenceUnitPostProcessor.java:49@Value("${hibernate.javax.cache.provider:#{null}}")
  • JCachePersistenceUnitPostProcessor.java:71properties.setProperty("hibernate.javax.cache.uri", ...)
  • JCachePersistenceUnitPostProcessor.java:78properties.setProperty("hibernate.javax.cache.provider", ...)
  • DefaultJCacheUriProvider.java:37@Value("${hibernate.javax.cache.uri:#{null}}")
  • DefaultJCacheUriProvider.java:40@Value("${hibernate.javax.cache.uri.relative:true}")
  • DefaultJCacheUriProvider.java:54,58 — log/error messages with old property names

devin-ai-integration Bot added a commit that referenced this pull request Apr 17, 2026
…s args, add @TestMethodOrder/@order

- Issue #1: Remove unused Method parameter from CustomerPhoneControllerTest.setupCustomerId()
  to prevent JUnit 5 ParameterResolutionException
- Issue #2: Swap assertEquals argument order from TestNG convention (actual, expected)
  to JUnit 5 convention (expected, actual) in RollbackTest, SystemPropertiesTest, WorkflowTest
- Issue #3: Add @TestMethodOrder(MethodOrderer.OrderAnnotation.class) and @order(N) annotations
  to 21 test classes with execution order dependencies to preserve test method ordering
- Use fully qualified @org.junit.jupiter.api.Order where it conflicts with domain Order class

Co-Authored-By: Arjun Mishra <arjunsaxmishra@gmail.com>
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