Skip to content

Fix lazy one to one with bytecode enhancements #1418

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

Merged
merged 4 commits into from
Nov 5, 2022

Conversation

DavideD
Copy link
Member

@DavideD DavideD commented Nov 4, 2022

Fix #1417

This should make it possible to fix the related issue on Quarkus.

I've decided to add an additional module to the project to test with bytecode enhancements. Hopefully, in the future we will have something better, but it beats not having tests. I've heard Hibernate ORM has some nice utilities for this.

Not sure how we didn't notice before, but the problem was that in this particular scenario we run a query that returns a CompletionStage and we try to assign it to one of the field. Instead we need to assign the result when it's ready.

@DavideD DavideD requested a review from gavinking November 4, 2022 18:04
@DavideD DavideD force-pushed the 1417-lazy-one-to-one branch from 45e05b3 to 52831a9 Compare November 4, 2022 18:05
@DavideD DavideD changed the title Fix lazy one to one with bytecode enhancement Fix lazy one to one with bytecode enhancements Nov 4, 2022
@DavideD
Copy link
Member Author

DavideD commented Nov 4, 2022

We need to revisit a bit this area and update the docs.
It's quite hard to figure out the right approach and fetch method to use for this type of mapping.

@lgtm-com
Copy link

lgtm-com bot commented Nov 4, 2022

This pull request introduces 1 alert when merging 52831a9 into 78dab9a - view on LGTM.com

new alerts:

  • 1 for Implicit conversion from array to string

Copy link
Member

@gavinking gavinking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

When using Bytecode Enhancements with a lazy bidirectional one-to-one,
we have an error because we rerturn a CompletionStage instead of
using the fetched object.

This commit should fix the issue.
Additional module for testing using Hibenrate ORM Bytecode Enhancements
The module uses the Hibernate Gradle plugin to enable the features.

This is not an elegant solution and there is some duplicated code from
the core module, but it beats not being able to test these use cases.
@DavideD DavideD force-pushed the 1417-lazy-one-to-one branch from 52831a9 to cd3b4d8 Compare November 5, 2022 08:47
@DavideD DavideD merged commit 13fb7c3 into hibernate:main Nov 5, 2022
@DavideD DavideD deleted the 1417-lazy-one-to-one branch November 8, 2022 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lazy one-to-one with Bytecode enhancement enabled doesn't work
2 participants