Activate Hibernate CI profile, update versions, and adjust tests#11
Conversation
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.
0c7c434
into
microsphere-projects:release-1.x
🤖 Augment PR SummarySummary: 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:
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 👎 |
| * @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) { |
There was a problem hiding this comment.
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
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
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
readOnlyparameter from the entity callback API, adding Java 9+ compatibility profiles, and refining test cases for clarity and best practices.API and Compatibility Improvements
readOnlyparameter from theEntityCallback.onLoadmethod and all its usages to simplify the callback interface and align with current usage patterns. This affectsEntityCallback,CompositeEntityCallback,EntityCallbackListener, and related test classes. [1] [2] [3] [4]jaxb-apiin bothmicrosphere-hibernate-core/pom.xmlandmicrosphere-hibernate-test/pom.xmlto improve compatibility with newer Java versions. [1] [2]Test Suite Refinements
AbstractHibernateH2Test.javato usesession.deleteinstead ofsession.removefor entity deletion, renamed the corresponding test method, and removed the redundant "persist & detach" test. Also improved queries to use fully qualified class names and replacedsession.findwithsession.loadfor better accuracy. [1] [2] [3] [4]Build and CI Adjustments
Documentation and Minor Fixes
README.mdto reflect the latest released versions for bothmainand1.xbranches.DelegatingInterceptorto use the correctEmptyInterceptorclass.HibernateExtensionto avoid unnecessary checks before closing sessions.requiresPostCommitHandlingmethod inEntityCallbackListener.