Skip to content

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

@ivu-mawi

Description

@ivu-mawi

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions