Skip to content
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

EmbeddedId broken in Hibernate Reactive #43651

Closed
danielbobbert opened this issue Oct 2, 2024 · 3 comments
Closed

EmbeddedId broken in Hibernate Reactive #43651

danielbobbert opened this issue Oct 2, 2024 · 3 comments
Labels
area/hibernate-reactive Hibernate Reactive kind/bug Something isn't working

Comments

@danielbobbert
Copy link
Contributor

Describe the bug

Wenn using Hibernate Reactive with @embeddable and @EmbeddedId, entities can no longer be loaded because of the new (incubating) "ReactiveInitializer" API.

Expected behavior

Existing entities should be loaded from database without problems.

Actual behavior

java.lang.ClassCastException: 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 @10d18696)
at org.hibernate.reactive.sql.results.graph.entity.internal.ReactiveEntityInitializerImpl.initializeId(ReactiveEntityInitializerImpl.java:748)
at org.hibernate.reactive.sql.results.graph.entity.internal.ReactiveEntityInitializerImpl.reactiveResolveKey(ReactiveEntityInitializerImpl.java:625)
at org.hibernate.reactive.sql.results.graph.entity.internal.ReactiveEntityInitializerImpl.reactiveResolveKey(ReactiveEntityInitializerImpl.java:605)
at org.hibernate.reactive.sql.results.graph.entity.internal.ReactiveEntityInitializerImpl.reactiveResolveKey(ReactiveEntityInitializerImpl.java:56)
at org.hibernate.reactive.sql.results.internal.ReactiveStandardRowReader.resolveKey(ReactiveStandardRowReader.java:383)

How to Reproduce?

See attached reproducer project.
The application contains an Entity which uses an embeddable ID.

The test creates two entities (which works fine), but then fails to load those entities with the aforementioned exception.
The root cause seems to be some confusion between "ReactiveInitializer", "EmbeddableInitializerImpl" and "ReactiveEmbeddableInitializerImpl".

The same code works with Quarkus 3.13.1 (just change the version in pom.xml to verify). It is broken since Quarkus 3.14 (and still broken in 3.15.1)

Output of uname -a or ver

No response

Output of java -version

21

Quarkus version or git rev

3.15.1

Build tool (ie. output of mvnw --version or gradlew --version)

mvn

Additional information

embedded-id-bug.zip

@danielbobbert danielbobbert added the kind/bug Something isn't working label Oct 2, 2024
@quarkus-bot quarkus-bot bot added the area/hibernate-reactive Hibernate Reactive label Oct 2, 2024
Copy link

quarkus-bot bot commented Oct 2, 2024

/cc @DavideD (hibernate-reactive), @gavinking (hibernate-reactive)

@DavideD
Copy link
Contributor

DavideD commented Oct 2, 2024

This issue should be fixed in Hibernate Reactive 2.4.1.Final that will be included in Quarkus 2.16 and probably 2.15.2.
The original issue for Hibernate Reactive is hibernate/hibernate-reactive#1979

@DavideD DavideD closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2024
@danielbobbert
Copy link
Contributor Author

Sounds great! Yes please, include that in 3.15.x
We are currently migrating a whole bunch of services from 3.8.6 to 3.15 and this bug is a show stopper for some of our services.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hibernate-reactive Hibernate Reactive kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants