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

Many To Many does not return correct entity on lazy join #13

Open
odelyaF opened this issue Jun 2, 2022 · 6 comments
Open

Many To Many does not return correct entity on lazy join #13

odelyaF opened this issue Jun 2, 2022 · 6 comments

Comments

@odelyaF
Copy link

odelyaF commented Jun 2, 2022

Hi,
I am trying to use the @jointable annotation with lazyGet methods.
I see that the lazyGet returns an instance of the current class.
For example from this repository AbstractTestManyToManyModel Entity3::lazyGetLinks should returns a Flux but instead it returns a Flux .
I saw it during debugging the code as well.
So how can Flux use lazy?

@lecousin
Copy link
Owner

lecousin commented Jun 5, 2022

I don't understand well the question, can you be more precise ?
The lazy feature means that it will fetch linked entites from database lazily, in other words when an entity A has a link to an entity B, and you fetch entity A, the linked entity B is not retrieved from the database directly but only on the first call of lazyGetB.
When a relationship is "many", it means zero to several entities may be linked, that's why it returns a Flux.

@odelyaF
Copy link
Author

odelyaF commented Jun 6, 2022

I will try to explain with an example:
I am using code from this repository with "many" relationships. (joinTable)
So I have Entity4: Entity4
and Entity3: Entity3
each one has a Set of the "Linked" entity and a lazyGet function which should return a Flux.
Running Test: AbtractManyToManyTest
With a breakpoint on line 319. I expect the lazyGetLinks to return a flux of "Entity3" but I got a Flux of "Entity4".

hope it was more explanatory.

@lecousin
Copy link
Owner

lecousin commented Jun 6, 2022

Ok, now I understand and can reproduce the issue, I will fix it

@lecousin
Copy link
Owner

lecousin commented Jun 6, 2022

This should be fixed by version 0.10.2, can you try to upgrade and tell if it is ok for you ?

@odelyaF
Copy link
Author

odelyaF commented Jun 6, 2022

working now. thank you for the quick fix!

@odelyaF
Copy link
Author

odelyaF commented Jun 27, 2022

Hi,
the solution worked nice for the id field but seems that other "lazy" entity fields are null.
For the example above the "Entity3" contains only an id but value field is null.

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

No branches or pull requests

2 participants