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

NplusOneTest.joinFetch - is different count of results expected? #2

Open
ValentinaBaranova opened this issue Feb 6, 2018 · 1 comment

Comments

@ValentinaBaranova
Copy link

List<Client> clients = session.createQuery("select c from NPlusOneClient c join fetch c.accounts where c.age >= :age")

Is it expected that we get here 13 clients because of join, while in database we have only 10?

@dgcd
Copy link
Contributor

dgcd commented Sep 14, 2020

Really, result list has size of 13 with duplicated clients, though there are 10 in DB. Quite unexpectable.
But there is good explanation of this behaviour:
https://stackoverflow.com/questions/18753245/one-to-many-relationship-gets-duplicate-objects-without-using-distinct-why

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