-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
@JoinColumns breaks on Hibernate Reactive #45188
Comments
/cc @DavideD (hibernate-reactive), @gavinking (hibernate-reactive), @geoand (kotlin) |
THanks for the reproducer, I will have a look |
For reference, this is our production repository where we originally found the issue, https://gitlab.com/rug-digitallab/products/themis/themis-core/-/tree/ls/172-persistence?ref_type=heads Here we get a slightly different error, as it tries to cast a different class: But yeah this repository is of course a lot more cluttered, so best to refer to the minimised reporducer |
@DavideD do you happen to know if this bug is resolvable in the near future? An important feature is currently blocked on this so we are thinking about whether it's reasonable to wait for this or move away from hibernate-reactive / redo our entity design to work around the bug. |
I didn’t have the time to check this, but I solved a similar issue not too
long ago. So, it shouldn't be too hard to fix it, once I've verified the
issue (finger crossed).
This happens when embedded ids are involved.
Because of the holidays, I don’t think I will be able to check this until
January though
Lars ***@***.***> schrieb am Do. 26. Dez. 2024 um 17:05:
… @DavideD <https://github.com/DavideD> do you happen to know if this bug
is resolvable in the near future? An important feature is currently blocked
on this so we are thinking about whether it's reasonable to wait for this
or move away from hibernate-reactive / redo our entity design to work
around the bug.
—
Reply to this email directly, view it on GitHub
<#45188 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEIQ5OQLHSKGROSP24TMKT2HQSNJAVCNFSM6AAAAABT2ZG65KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRSHEYTMMZWHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@DavideD thanks a lot for taking your time for this. Have you had a chance to look at it? |
I will have a look at this this week |
Hi, we figured out the problem. It's the same as this one: hibernate/hibernate-reactive#2060 It will be fixed in the next release |
Describe the bug
If you write an entity like the following:
And then try to retrieve it from the database when using Hibernate Reactive, your program crashes with a rather vague exception (and no usable stacktrace:
class org.hibernate.sql.results.graph.embeddable.internal.EmbeddableInitializerImpl cannot be cast to class org.hibernate.reactive.sql.results.graph.ReactiveInitializer (org.hibernate.sql.results.graph.embeddable.internal.EmbeddableInitializerImpl and org.hibernate.reactive.sql.results.graph.ReactiveInitializer are in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @2fc0cc3)
As far as I understand, this happens because Hibernate Reactive does not support
JoinColumns
, which then makes it fall back on the default Hibernate ORM implementation, which breaks because you can't run non-reactive code in a reactive context.I think the problem is twofold. Ideally, this would be fixed such that it works, but also the exception in its current form is incredibly hard to debug. This took us a really long time to figure out, reproduce, and isolate from the rest of the entity code to figure out this was causing the issue.
I made a minimal reproduction of the issue, which you can pull from here: https://gitlab.com/l.s.andringa1/hibernate-reactive-reproducer. There is a unit test in that project that breaks with the explained issue.
Expected behavior
When running
repository.find()
, the entity should simply be retrieved from the database without throwing exceptions.Actual behavior
Hibernate throws an exception around using non-reactive code in a reactive environment
How to Reproduce?
Reproducer: https://gitlab.com/l.s.andringa1/hibernate-reactive-reproducer
Steps:
EntityTest
unit testOutput of
uname -a
orver
6.11.0-13-generic #14-Ubuntu SMP PREEMPT_DYNAMIC Sat Nov 30 23:51:51 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk version "21.0.5" 2024-10-15
Quarkus version or git rev
3.17.4
Build tool (ie. output of
mvnw --version
orgradlew --version
)Gradle 8.9
Additional information
No response
The text was updated successfully, but these errors were encountered: