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

Multiple collection joins result in duplicate results #233

Closed
Mobe91 opened this issue Sep 14, 2016 · 2 comments
Closed

Multiple collection joins result in duplicate results #233

Mobe91 opened this issue Sep 14, 2016 · 2 comments
Assignees
Milestone

Comments

@Mobe91
Copy link
Contributor

Mobe91 commented Sep 14, 2016

When we have multiple collections joins in combination with restrictions (like an array access on a collection), hibernate generates left joins only. This causes duplicate entries in the result list. E.g.:

LEFT OUTER JOIN personlist personlist6_ ON documentfo0_.id=personlist6_.DocumentForCollections_id
LEFT OUTER JOIN PersonForCollections personforc7_ ON personlist6_.personList_id=personforc7_.id
AND (personlist6_.position=1)

It is not clear whether the alteration of the second join type to an inner joins is a general solution although it would fix this concrete case.

To reproduce, comment in the personList[1] mapping in com.blazebit.persistence.view.testsuite.collections.basic.model.BasicDocumentSetMapListView and run com.blazebit.persistence.view.testsuite.collections.basic.BasicCollectionsTest#testCollections.

@Mobe91
Copy link
Contributor Author

Mobe91 commented Sep 14, 2016

Blocks #191

@beikov
Copy link
Member

beikov commented Sep 16, 2016

Also see: https://hibernate.atlassian.net/browse/HHH-9329
I think we should implement a workaround for this as described in my last comment since the hibernate team is probably not going to fix this before Hibernate 6 and for that we will still have to wait some time.

@beikov beikov self-assigned this Sep 16, 2016
@beikov beikov added this to the 1.2.0 milestone Sep 16, 2016
@beikov beikov closed this as completed in 032b72d Sep 16, 2016
beikov added a commit to beikov/blaze-persistence that referenced this issue Mar 15, 2017
…lazebit#233 which is fixed by properly doing subquery join rewrites now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants