-
Notifications
You must be signed in to change notification settings - Fork 55
feat: add where relation attributes criteria expressions #96
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #96 +/- ##
===========================================
+ Coverage 65.06% 66.17% +1.1%
- Complexity 328 338 +10
===========================================
Files 37 37
Lines 1955 2022 +67
Branches 286 290 +4
===========================================
+ Hits 1272 1338 +66
+ Misses 556 555 -1
- Partials 127 129 +2
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #96 +/- ##
============================================
+ Coverage 65.06% 65.34% +0.27%
- Complexity 328 348 +20
============================================
Files 37 37
Lines 1955 1962 +7
Branches 286 291 +5
============================================
+ Hits 1272 1282 +10
+ Misses 556 553 -3
Partials 127 127
Continue to review full report at Codecov.
|
@molexx I think it is good to be merged with the last fix. Have you tried it? Let me know. |
Thanks. Will be tested from our front-end project tomorrow, I'll let you know! |
Thanks, this works but is a bit restricted in that you can only use a relationship of the first entity, after that you can only use simple attributes as before. For example:
you can say ' |
@molexx This is not possible right now. I had to disable nested relationship attributes is search criteria expressions because it is not clear right now how to construct complex joins and predicates for Jpa queries to make it work correctly. If you have any ideas let me know. I am also working on optimizing predicate building to avoid duplicating predicates in SQL where expressions. There is a strange caching issue that makes Hibernate cache first result for filtered collection. After that, it will keep returning the same result even if collection filter changes. I experience this via GraphiQL app only, but the unit tests work as expected.. |
@molexx I am ready to merge this PR if there are no other comments. We can try to solve complex relation attribute criteria expressions later. I just want to be careful about it. I have also resolved Hibernate object mapping caching issue by clearing session cache with |
Yes this looks good to me, thanks. Thanks for all your work on this. I hope we can find a way to allow nested relationships. |
Continuing the conversation about nesting relationships in #97 |
fixes #76
This PR adds support for many-to-one and one-to-many entity attributes in where criteria expressions with variable parameter bindings, i.e.
Given the following query with many-to-one relation:
will result in
And given the following query with one-to-many relation:
will result in
It is possible to use compound criterias in where search expressions given:
Will return filtered inner collection result:
It is also possible to filter inner collections as follows:
will result in