HAPI has released a latest docker image on 27-Feb-2023. In this version due to some upgrades on the hibernate dependencies, the earlier hibernate dialect setting spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL95Dialect is not working anymore. It results in the below error.
Error logs on start of HAPI server
hapi-server | Caused by: org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.hibernate.dialect.PostgreSQL95Dialect] as strategy [org.hibernate.dialect.Dialect]
hapi-server | at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:154)
hapi-server | at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:129)
hapi-server | at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
hapi-server | ... 118 common frames omitted
hapi-server | Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [org.hibernate.dialect.PostgreSQL95Dialect]
hapi-server | at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:126)
hapi-server | at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:150)
hapi-server | ... 128 common frames omitted
hapi-server | Caused by: java.lang.ClassNotFoundException: Could not load requested class : org.hibernate.dialect.PostgreSQL95Dialect
hapi-server | at org.hibernate.boot.registry.classloading.internal.AggregatedClassLoader.findClass(AggregatedClassLoader.java:216)
hapi-server | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:592)
hapi-server | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
hapi-server | at java.base/java.lang.Class.forName0(Native Method)
hapi-server | at java.base/java.lang.Class.forName(Class.java:467)
hapi-server | at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:123)
hapi-server | ... 129 common frames omitted
In the latest hapi release, the artifact ca.uhn.hapi.fhir:hapi-fhir has been upgraded to version 7.0.0. In this 7.0.0 version the HIbernate.version used in 6.4.1.Final. Support for the dialect org.hibernate.dialect.PostgreSQL95Dialect has been removed in this hibernate version and is replaced with org.hibernate.dialect.PostgreSQLDialect. We could have used this dialect instead, but hapi recommends using this
ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgresDialect
E2E test
TESTED:
Please replace this with a description of how you tested your PR beyond the
automated e2e/unit tests.
Description of what I changed
HAPI has released a latest docker image on 27-Feb-2023. In this version due to some upgrades on the
hibernate
dependencies, the earlier hibernate dialect settingspring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL95Dialect
is not working anymore. It results in the below error.Error logs on start of HAPI server
Fix
The latest
hapi
release supports this dialect ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgresDialect which is the recommended dialect by hapi-fhir.More details
In the latest hapi release, the artifact
ca.uhn.hapi.fhir:hapi-fhir
has been upgraded to version 7.0.0. In this7.0.0
version the HIbernate.version used in6.4.1.Final
. Support for the dialectorg.hibernate.dialect.PostgreSQL95Dialect
has been removed in this hibernate version and is replaced withorg.hibernate.dialect.PostgreSQLDialect
. We could have used this dialect instead, but hapi recommends using this ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgresDialectE2E test
TESTED:
Please replace this with a description of how you tested your PR beyond the automated e2e/unit tests.
Checklist: I completed these to help reviewers :)
[x] I have read and will follow the review process.
[x] I am familiar with Google Style Guides for the language I have coded in.
No? Please take some time and review Java and Python style guides.
[x] My IDE is configured to follow the Google code styles.
No? Unsure? -> configure your IDE.
[ ] I have added tests to cover my changes. (If you refactored existing code that was well tested you do not have to add tests)
[x] I ran
mvn clean package
right before creating this pull request and added all formatting changes to my commit.[x] All new and existing tests passed.
[x] My pull request is based on the latest changes of the master branch.
No? Unsure? -> execute command
git pull --rebase upstream master