Skip to content

Activate Hibernate CI profile, update versions, and adjust tests#11

Merged
mercyblitz merged 9 commits into
microsphere-projects:release-1.xfrom
mercyblitz:dev-1.x
May 22, 2026
Merged

Activate Hibernate CI profile, update versions, and adjust tests#11
mercyblitz merged 9 commits into
microsphere-projects:release-1.xfrom
mercyblitz:dev-1.x

Conversation

@mercyblitz

Copy link
Copy Markdown
Contributor

This pull request introduces several important changes to improve compatibility, streamline testing, and clean up the codebase, particularly in the Hibernate integration and test modules. The most significant updates include removing the readOnly parameter from the entity callback API, adding Java 9+ compatibility profiles, and refining test cases for clarity and best practices.

API and Compatibility Improvements

  • Removed the readOnly parameter from the EntityCallback.onLoad method and all its usages to simplify the callback interface and align with current usage patterns. This affects EntityCallback, CompositeEntityCallback, EntityCallbackListener, and related test classes. [1] [2] [3] [4]
  • Added a Java 9+ Maven profile with an optional dependency on jaxb-api in both microsphere-hibernate-core/pom.xml and microsphere-hibernate-test/pom.xml to improve compatibility with newer Java versions. [1] [2]

Test Suite Refinements

  • Updated test methods in AbstractHibernateH2Test.java to use session.delete instead of session.remove for entity deletion, renamed the corresponding test method, and removed the redundant "persist & detach" test. Also improved queries to use fully qualified class names and replaced session.find with session.load for better accuracy. [1] [2] [3] [4]

Build and CI Adjustments

  • Limited the GitHub Actions Maven build workflow to run tests only on Java 8 (previously ran on Java 8, 11, 17, 21, 25) and fixed the activation of Maven profiles to include both Spring Cloud and Hibernate variants. [1] [2]

Documentation and Minor Fixes

  • Updated the README.md to reflect the latest released versions for both main and 1.x branches.
  • Fixed a JavaDoc reference in DelegatingInterceptor to use the correct EmptyInterceptor class.
  • Improved session cleanup logic in HibernateExtension to avoid unnecessary checks before closing sessions.
  • Removed an unnecessary override and simplified the requiresPostCommitHandling method in EntityCallbackListener.

github-actions Bot and others added 9 commits May 21, 2026 15:26
Enable the maven-hibernate matrix profile in the GitHub Actions maven-build workflow so tests run with the Hibernate profile. Also update README branch version badges: main 0.2.1 -> 0.2.2 and 1.x 0.1.1 -> 0.1.2 to reflect the latest releases. Files changed: .github/workflows/maven-build.yml, README.md.
Remove the Boolean readOnly parameter from EntityCallback.onLoad and propagate the signature change across implementations (CompositeEntityCallback, EntityCallbackListener, TestEntityCallback). Update EntityCallbackListener to call the new onLoad signature and simplify requiresPostCommitHandling to return false. Adjust tests and test utilities: rename testPersistAndRemove to testPersistAndDelete, replace session.remove calls with session.delete, remove testPersistAndDetach, switch session.find to session.load, use a fully-qualified query and .list(), and relax a statelessSession isOpen check in HibernateExtension. Minor logging and Javadoc formatting tweaks to reflect the API changes.
Update Javadoc to reference org.hibernate.EmptyInterceptor#INSTANCE instead of the internal org.hibernate.internal.EmptyInterceptor, ensuring the comment points to the public API rather than an internal class.
Introduce a Maven profile named 'java9+' (activated for JDK [9,)) to both microsphere-hibernate-core and microsphere-hibernate-test pom.xml files. The profile adds an optional dependency on javax.xml.bind:jaxb-api so the JAXB API is available on Java 9+ where it is no longer bundled with the JDK.
Delete the JUnit test method testPersistAndGetManagedEntities from AbstractHibernateH2Test. The removed method previously persisted a User and executed a HQL query (FROM io.microsphere.hibernate.test.entity.User) inside a transaction; its @test and @DisplayName annotations were also removed.
Narrow the GitHub Actions maven-build job to run only on Java 8 to reduce the CI matrix. Add a new JUnit test (testPersistAndGetManagedEntities) to AbstractHibernateH2Test which persists a User in a transaction and verifies a query for User entities returns a non-empty result.
Add a GitHub Actions workflow to build and test the project with Maven across Java versions 11, 17, 21, and 25. The matrix also exercises multiple Spring Cloud and Hibernate profiles, caches Maven dependencies, runs tests with test and coverage profiles, and uploads coverage to Codecov (uses secrets.CODECOV_TOKEN). The workflow runs on pushes to dev-1.x and pull requests against dev-1.x and release-1.x.
@codecov

codecov Bot commented May 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...phere/hibernate/entity/EntityCallbackListener.java 50.00% 1 Missing ⚠️
...microsphere/hibernate/test/HibernateExtension.java 0.00% 0 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ Complexity Δ
...o/microsphere/hibernate/DelegatingInterceptor.java 100.00% <ø> (ø) 21.00 <0.00> (ø)
...here/hibernate/entity/CompositeEntityCallback.java 100.00% <100.00%> (ø) 24.00 <1.00> (ø)
...o/microsphere/hibernate/entity/EntityCallback.java 100.00% <ø> (ø) 23.00 <0.00> (ø)
...sphere/hibernate/test/AbstractHibernateH2Test.java 100.00% <100.00%> (ø) 5.00 <0.00> (ø)
...phere/hibernate/entity/EntityCallbackListener.java 98.33% <50.00%> (ø) 30.00 <0.00> (ø)
...microsphere/hibernate/test/HibernateExtension.java 76.62% <0.00%> (ø) 40.00 <0.00> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mercyblitz mercyblitz merged commit 0c7c434 into microsphere-projects:release-1.x May 22, 2026
69 of 70 checks passed
@augmentcode

augmentcode Bot commented May 22, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR updates the Hibernate integration and CI setup to improve version/profile coverage and Java 9+ compatibility, while simplifying the entity callback API.

Changes:

  • Added a dedicated GitHub Actions workflow to run the full Spring Cloud + Hibernate profile matrix on Java 11/17/21/25.
  • Adjusted the existing CI workflow to run tests only on Java 8 and to activate the selected Hibernate profile in the Maven build.
  • Introduced a java9+ Maven profile in core and test modules adding an optional javax.xml.bind:jaxb-api dependency for newer JDKs.
  • Simplified EntityCallback.onLoad by removing the readOnly parameter and updated listeners/composites/tests accordingly.
  • Refined Hibernate H2 tests (delete vs remove, load vs find, query adjustments) and streamlined session cleanup in the JUnit extension.
  • Updated README release version numbers and fixed a Javadoc link in DelegatingInterceptor.

Technical Notes: CI now explicitly combines Spring Cloud + Hibernate profiles during test runs; entity load callback signatures are updated across the listener/composite/test callback implementations.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

* @see LoadEventListener
*/
default void onLoad(Object id, String entityClassName, Object entity, LockMode lockMode, boolean isAssociationFetch, Object result, Boolean readOnly, LoadType loadType) {
default void onLoad(Object id, String entityClassName, Object entity, LockMode lockMode, boolean isAssociationFetch, Object result, LoadType loadType) {

@augmentcode augmentcode Bot May 22, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

After removing the readOnly parameter from onLoad, the higher-level Javadoc examples in this interface still show the old signature (including Boolean readOnly), which can mislead implementers. Other locations where this applies: microsphere-hibernate-core/src/main/java/io/microsphere/hibernate/entity/CompositeEntityCallback.java:64.

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

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