Skip to content

Always instantiate Hibernate ORM collections in the default fetch group #27666

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
Sep 7, 2022

Conversation

yrodiere
Copy link
Member

@yrodiere yrodiere commented Sep 1, 2022

... be it for Hibernate Reactive (as before) or for Hibernate ORM.

Fixes #27657
Fixes #4644 (according to #27657 (reply in thread))

Fixes problems such as #27657, where calling a getter to retrieve a collection on an initialized entity would throw a LazyInitializationException, whereas one would expect the exception to be thrown later, when accessing the collection itself (.size(), .iterator(), ...).

This sets defaults as suggested by @gavinking and @Sanne when the option was introduced some time ago: hibernate/hibernate-orm#3558 (comment), hibernate/hibernate-orm#3558 (comment)

@quarkus-bot
Copy link

quarkus-bot bot commented Sep 1, 2022

/cc @Sanne, @gsmet

@quarkus-bot quarkus-bot bot added area/hibernate-orm Hibernate ORM area/persistence OBSOLETE, DO NOT USE labels Sep 1, 2022
@yrodiere yrodiere force-pushed the enableCollectionInDefaultFetchGroup branch from 3dc26d7 to 33cc9d0 Compare September 1, 2022 13:24
@yrodiere yrodiere added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Sep 1, 2022
@plevart
Copy link
Contributor

plevart commented Sep 1, 2022

Cool. Is this going to make it into Quarkus 2.12.1 ?

@yrodiere
Copy link
Member Author

yrodiere commented Sep 1, 2022

Cool. Is this going to make it into Quarkus 2.12.1 ?

I'm not sure that would be wise... It's a rather significant change, and could have a (small) performance impact. @Sanne, any opinion on that?

@Sanne
Copy link
Member

Sanne commented Sep 1, 2022

I'd prefer it to be limited to the next minor but I have no strong opinion.

@yrodiere
Copy link
Member Author

yrodiere commented Sep 2, 2022

FWIW I submitted a PR (hibernate/hibernate-orm#5252) to make this the default in Hibernate ORM 6.2. I hade to change a few tests though; and that won't become the default in 5.x (which Quarkus currently uses, and will use until we migrate to Jakarta EE).

This is a rather complex situation, so I'll discuss with @gsmet when/where he thinks it would be best to merge this.

@yrodiere yrodiere requested a review from gsmet September 2, 2022 12:45
@yrodiere yrodiere added triage/needs-decision This issue proposes a design change. Needs to be discussed in the ML and removed triage/waiting-for-ci Ready to merge when CI successfully finishes labels Sep 2, 2022
@yrodiere yrodiere force-pushed the enableCollectionInDefaultFetchGroup branch from 33cc9d0 to 2f77645 Compare September 7, 2022 07:09
@gsmet gsmet merged commit 036a69f into quarkusio:main Sep 7, 2022
@quarkus-bot quarkus-bot bot added this to the 2.13 - main milestone Sep 7, 2022
@gsmet gsmet added triage/backport? and removed triage/needs-decision This issue proposes a design change. Needs to be discussed in the ML labels Sep 7, 2022
@gsmet gsmet modified the milestones: 2.13 - main, 2.12.2.Final Sep 12, 2022
@yrodiere yrodiere deleted the enableCollectionInDefaultFetchGroup branch October 28, 2022 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ObjectMapperCustomizer with Hibernate5Module for lazyloading
4 participants