Skip to content

Fix wrong inner join fetch on not lazy component key-many-to-one property in Criteria #2513

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 9, 2020

Conversation

bahusoid
Copy link
Member

@bahusoid bahusoid commented Sep 3, 2020

Fixes #766

From original issue:

If a class has a one-to-many reference to a second class that has key-many-to-one back reference to it, and I try to eager fetch this relation, inner joins are added to the query for all key-many-to-one references of the second class.
...IMO they shouldn't be there...

Joins are added because key-many-to-one entities in test case are not lazy. That's correct standard behavior. Only those joins should be LEFT JOIN as joins created for fetched associations entity.AssociationTableCollection.FirstTable

Copy link
Member

@hazzik hazzik left a comment

Choose a reason for hiding this comment

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

This was fun

@hazzik
Copy link
Member

hazzik commented Sep 4, 2020

It seems I broke codefactor. Ooops.

@bahusoid

This comment has been minimized.

hazzik
hazzik previously approved these changes Sep 4, 2020
@hazzik hazzik added this to the next minor milestone Sep 4, 2020
@hazzik hazzik added the t: Fix label Sep 4, 2020
@hazzik
Copy link
Member

hazzik commented Sep 8, 2020

There's no hope with CodeFactor...

@bahusoid
Copy link
Member Author

bahusoid commented Sep 9, 2020

There's no hope with CodeFactor...

Should we get rid of added Settings.StyleCop?

@hazzik
Copy link
Member

hazzik commented Sep 9, 2020

Should we get rid of added Settings.StyleCop?

I think let is stay there.

@hazzik hazzik merged commit 3a5f949 into nhibernate:master Sep 9, 2020
@hazzik hazzik added the r: Fixed label Sep 9, 2020
@bahusoid
Copy link
Member Author

bahusoid commented Sep 9, 2020

Codefactor confirmed it's not currently supported:

Settings.StyleCop file will be effective only when placed in repo root and impacts whole repo.
We have noted this feature request and will consider rolling it out based on further demand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NH-3813 - Eager fetch on key-many-to-one relation adds inner joins to the query
2 participants