Skip to content

Hibernate Reactive eager fetching the wrong record for ManyToOne #46917

@oaklandcorp-jkaiser

Description

@oaklandcorp-jkaiser

Describe the bug

Automated tests are showing me some incorrect answers after upgrading an existing API. It seems like when many records are returned from SQL and each of those records have a unique nested record eagerly fetched and joined in those nested records may be the wrong one. I believe the bug I'm seeing is mostly related to a field with the decorator @ManyToOne(fetch = FetchType.EAGER, optional = false).

Expected behavior

The correct nested record is joined.

Actual behavior

Sometimes the wrong nested record is joined.

How to Reproduce?

I created a commit off of the 3.15 branch of the quarkus-quickstarts project that I believe is representative of the issue I'm seeing in a real project. The single new test case should demo the API returning the wrong response.

quarkusio/quarkus-quickstarts@56355c0

Output of uname -a or ver

Linux dev 6.8.0-52-generic #53~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jan 15 19:18:46 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk 17.0.6 2023-01-17 LTS

Quarkus version or git rev

3.15.4

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

Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)

Additional information

After the release of Quarkus 3.15.4 I've tried to upgrade an API that has been stuck back in Quarkus 3.8 due to Hibernate Reactive bugs. The last issue I encountered has been fixed but now automated tests show some incorrect answers coming back from the API.

I did test this on Quarkus 3.20 as well and it seems to suffer from the same issue.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions