-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
org.hibernate.bytecode.enhance.spi.EnhancementException: Enhancement of [org.acme.domain.MyEntity] failed #44863
Comments
Hello @KaiSuchomel, thank you for reporting the issue and providing a simple mapping which reproduces your problem. The error you're facing is caused by a recent change in Hibernate's bytecode-enhancement logic: https://hibernate.atlassian.net/browse/HHH-16572. The new check is needed because support for bytecode enhanced entities with Using Regardless, I believe the check should work in this case since:
We should open an issue on Hibernate ORM's Jira to keep track of this and possibly improve the check. Edit: created https://hibernate.atlassian.net/browse/HHH-18904 |
@geoand I believe so, yes, I've added a link to that issue and its reproducer to the ORM Jira - thanks for the ping. |
I've recently encountered a similar issue that seems to be related, but haven't yet seen a report of this exact manifestation of it either here or on the Hibernate Jira. If an entity:
Then the build fails also with a similar EnhancementException. I can put together a full repro project and/or post on the Hibernate Jira if it would help, but the only required code for reproduction is a Quarkus 3.17.2+ project using
The result of
Basically, the bytecode enhancement process seems to now be only considering fields declared in the class that contains the getters/setters, whereas it previously detected inherited fields without issue. The same code builds fine using Quarkus 3.17.0 or lower. |
@wcicola the present issue was fixed in https://hibernate.atlassian.net/browse/HHH-18904, which means it's fixed in Quarkus 3.17.6 (through #45235). I unfortunately forgot to close issues fixed in the latest ORM version, I'll get to it right now. Could you please test this with Quarkus 3.17.6, and if your problem still occurs, open a new issue? Preferably, directly on hibernate.atlassian.net and with a reproducer based on this. Thank you. |
@wcicola I think I know where the bug might come from on the Hibernate ORM side, I believe it's not a Quarkus-related issue. +1 on what @yrodiere said, please open an issue on Hibernate's issue tracker and include a simple reproducer test case with the problematic mappings. |
Describe the bug
Exception occurs during Build:
org.hibernate.bytecode.enhance.spi.EnhancementException: Enhancement of [org.acme.domain.MyEntity] failed because no field named [modelType] could be found for property accessor method [getModelType]. To fix this, make sure all property accessor methods have a matching field.
Expected behavior
The Build should succeed.
Actual behavior
When building the project:
ERROR] Caused by: java.util.concurrent.ExecutionException: org.hibernate.bytecode.enhance.spi.EnhancementException: Enhancement of [org.acme.domain.MyEntity] failed because no field named [modelType] could be found for property accessor method [getModelType]. To fix this, make sure all property accessor methods have a matching field.
How to Reproduce?
Reproducer: https://github.com/KaiSuchomel/quarkus-test/tree/hibernate
Just build the project with maven.
Simple Entity:
After changing the PrePersist setter to a seperate name the build is working:
Output of
uname -a
orver
Darwin Mac-C6VD4H4XT3 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:00:32 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6030 arm64
Output of
java -version
openjdk version "21.0.5" 2024-10-15 OpenJDK Runtime Environment Homebrew (build 21.0.5) OpenJDK 64-Bit Server VM Homebrew (build 21.0.5, mixed mode, sharing)
Quarkus version or git rev
3.17.2 --> hibernate-core 6.6.3
Build tool (ie. output of
mvnw --version
orgradlew --version
)Maven home: /opt/homebrew/Cellar/maven/3.9.9/libexec Java version: 21.0.5, vendor: Homebrew, runtime: /opt/homebrew/Cellar/openjdk@21/21.0.5/libexec/openjdk.jdk/Contents/Home Default locale: de_DE, platform encoding: UTF-8 OS name: "mac os x", version: "15.1.1", arch: "aarch64", family: "mac"
Additional information
@yrodiere Can you please check. Thx.
See: hibernate/hibernate-orm@b5221e2#diff-5f775bce3db8bc5527104f2eba37fef522276d3bed00a3276545528ab233c380R16
The text was updated successfully, but these errors were encountered: