To use OpenJPA instead of Hibernate:
- Update
pom.xml
to excludehibernate-core
and instead include theopenjpa
dependencies andopenjpa-maven-plugin
configuration - Use the
OpenJpaConfiguration
class to configure OpenJPA - Copy in the
OpenJPADialect
andOpenJPAVendorAdapter
classes into your project - Update the
spring.jpa.properties
inapplication.yml
to properly set up OpenJPA - Copy the
src/main/resources/META-INF/persistence.xml
file into your project - Verify via a test case that the configuration works
OpenJPA does not have a dedicated build for Jakarta EE 9. Instead, "Shade" is used to produce
a classified build that is compatible with the new APIs. As such, the pom.xml
file has quirky
configuration to manage the dependencies. For more information, see this link:
https://rmannibucau.metawerx.net/openjpa-jakarta-tips.html
Also, an Apache Syncope dependency was previously used for OpenJPA vendor support. That dependency had code that was once part of Spring (OpenJPADialect and OpenJPAVendorAdapter). Since that code was not updated to the latest APIs, I copied that code into this project (same license) and made the appropriate Jakarta API change myself.