Skip to content
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

Partial fix fetching lazy property after Select in Linq #3392

Merged
merged 3 commits into from
Aug 4, 2023

Conversation

bahusoid
Copy link
Member

@bahusoid bahusoid commented Aug 2, 2023

Partial fix of #3356

Added proper from node detection required for lazy property fetching.

To fully fix #3356 we need to find a way to reliable detect query source (see #3392 (comment))

@@ -11,12 +12,15 @@ public class ProcessFetch
{
public void Process(FetchRequestBase resultOperator, QueryModelVisitor queryModelVisitor, IntermediateHqlTree tree)
{
var querySource = QuerySourceLocator.FindQuerySource(
Copy link
Member Author

Choose a reason for hiding this comment

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

QuerySourceLocator.FindQuerySource can't reliably detect query source. Instead of actually query source it finds first source with "compatible" type

@hazzik hazzik mentioned this pull request Aug 2, 2023
@hazzik
Copy link
Member

hazzik commented Aug 2, 2023

Nah, it still does not work. It now has different problems. My understanding of the problem currently is that fetch requests are not properly associated to the query source.

@bahusoid
Copy link
Member Author

bahusoid commented Aug 2, 2023

My understanding of the problem currently is that fetch requests are not properly associated to the query source.

No. It's still about proper query source detection. Now it isn't detected properly for ReuseJoinScalarSelect test case.

@bahusoid bahusoid changed the title Fix fetching after Select in Linq WIP Fix fetching after Select in Linq Aug 2, 2023
@bahusoid
Copy link
Member Author

bahusoid commented Aug 2, 2023

Need to find a way to reliable detect query source. I don't quite understand why query source is not part of FetchBaseRequest.

@bahusoid bahusoid changed the title WIP Fix fetching after Select in Linq Partial fix fetching lazy property after Select in Linq Aug 3, 2023
@bahusoid
Copy link
Member Author

bahusoid commented Aug 3, 2023

#3356 test case exposes 2 unrelated issues:

  1. Invalid query source detection (possible when joins on the same or assignable types are involved)
  2. Fetch is added to wrong from hql node.

This PR fixes second issue (currently it's unclear how to fix first issue)

@fredericDelaporte fredericDelaporte added this to the 5.5 milestone Aug 3, 2023
@bahusoid bahusoid merged commit 8f05f67 into nhibernate:master Aug 4, 2023
10 checks passed
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.

Fetch after Select applies to wrong entity
3 participants