Skip to content

Hibernate Reactive: ClassCastException when using a mapping with composite (embeddable) foreign key #48033

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

Open
ivu-mawi opened this issue May 23, 2025 · 2 comments
Assignees
Labels
area/hibernate-reactive Hibernate Reactive kind/bug Something isn't working

Comments

@ivu-mawi
Copy link

Describe the bug

I seem to be having an issue similar to this one.

My model has a bidirectional OneToMany / ManyToOne relationship: Each Link (between two NetPoints) has a list of GPSPoints. The foreign key consists of multiple fields (Embeddable).

When I use the Link.findAll().list() method, I get an exception:

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 

Link.<Link>findById(key) works.

Am I doing something wrong or is this a bug? I have not used Hibernate much before.

Expected behavior

My test case, where I call Link.findAll().list(), should work.

Actual behavior

The test fails with a ClassCastException.

How to Reproduce?

I have pushed my minimal example reproducer here:

https://github.com/ivu-mawi/hibernate-reactive-bug

You can see the failing test output in the CI as well. This one works. This one fails.

Output of uname -a or ver

No response

Output of java -version

Temurin-21.0.7+6

Quarkus version or git rev

3.22.3

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

3.9.9

Additional information

No response

@ivu-mawi ivu-mawi added the kind/bug Something isn't working label May 23, 2025
@ivu-mawi ivu-mawi changed the title ClassCastException when using a mapping with composite (embeddable) foreign key Hibernate Reactive: ClassCastException when using a mapping with composite (embeddable) foreign key May 23, 2025
@geoand geoand added area/hibernate-reactive Hibernate Reactive and removed triage/needs-triage labels May 26, 2025
Copy link

quarkus-bot bot commented May 26, 2025

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

@DavideD
Copy link
Contributor

DavideD commented May 30, 2025

Thanks for the feedback.

It's a bug in Hibernate Reactive, I've created an issue here: hibernate/hibernate-reactive#2284

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

3 participants