-
Notifications
You must be signed in to change notification settings - Fork 93
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
Transform SIZE in where clause to COUNT in having clause #188
Comments
Just as a side note, this issue is about composite ids and count: https://hibernate.atlassian.net/browse/HHH-11042 |
The tuple count distinct emulation is implemented now. |
Currently SIZE in the WHERE clause gets passed through unmodified for the JPA provider to handle. Note that the use of SIZE in GROUP BY is currently not possible because of #195 |
The transformation of SIZE to subqueries in ON clauses is covered by the tests already. |
As this transformation oftentimes requires the addition of a select item and grouping by all select items, I decided to not implement this as the performance is probably way worse than using a subquery. |
Instead of creating a subquery for the SIZE function when appearing in the where clause, we can transform it into
as long as there are no group bys present.
Multiple SIZE usages require to use COUNT(DISTINCT newAlias) which is not possible for some DBs when the relation uses a composite id.
This tranformation should be deactivatable via a property.
The text was updated successfully, but these errors were encountered: