HHH-17643 breaks Spring Framework native image support with Hibernate 6.4.3+
and 6.2.21+
as it breaks the substitution shipped with Spring Framework with the following error message:
Error: Could not find target method: public static org.hibernate.bytecode.spi.BytecodeProvider org.springframework.orm.jpa.vendor.Target_BytecodeProviderInitiator.buildBytecodeProvider(java.lang.String)
Such breakage in a patch release, even if triggered by a change on an internal Hibernate API, is unfortunate given the ongoing effort between the 2 teams to try to collaborate on a suitable solution with synchronisation on both sides to avoid such unanticipated breakage, as it has been identified as a fragile (but required) way to make Hibernate compatible with Spring on native.
In practice, that means Spring Boot 3.2.3
and 3.1.9
applications based respectively on Spring Framework 6.1.4
and 6.0.17
will have to downgrade Hibernate version on native to respectively Hibernate 6.4.2
and 6.2.20
.
The Spring Framework upcoming fix in 6.1.5
and 6.0.18
will consist in 2 parts:
- Make the Target_BytecodeProviderInitiator
substitution more lenient by checking the related method exists before applying it.
- Exclude the Bytebuddy BytecodeProvider
on native by shipping a native-image-properties
with -H:ServiceLoaderFeatureExcludeServices=org.hibernate.bytecode.spi.BytecodeProvider
.
The follow-up https://github.com/spring-projects/spring-framework/issues/32314 Spring Framework 6.2 issue has ben created to remove completely the 2 Hibernate substitutions when Hibernate 6.4.5
will be released with HHH-17568 fixed.
Comment From: sdeleuze
As mentioned in Spring Boot 3.2.3 release notes:
This release upgrades to Hibernate 6.4.4.Final. While it contains a number of valuable bug fixes, it does not work correctly in a native image. If you are using GraalVM, Hibernate should be temporarily downgraded to 6.4.2.Final using the
hibernate.version
property.