You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When defining a custom property/field, the docs say we can use the provided fetchArguments for retrieving the fetch options or the list of join properties. However, it's perpetually empty, and hence we lose out on the automatic join operations.
Oddly enough, the test for this functionality appears to actually confirm this:
//queries.size() == 2 ignored due to GORM issue https://github.com/grails/grails-data-mapping/issues/989
queries[0] ==~'Hibernate: select this_.id as id[0-9]+_[0-9]+_[0-9]+_, this_.version as version[0-9]+_[0-9]+_[0-9]+_, this_.name as name[0-9]+_[0-9]+_[0-9]+_ from tag this_ where this_.id=\\? limit \\?\n'
queries[1] ==~'Hibernate: select this_.id as id[0-9]+_[0-9]+_[0-9]+_, this_.version as version[0-9]+_[0-9]+_[0-9]+_, this_.title as title[0-9]+_[0-9]+_[0-9]+_, this_.date_created as date_cre[0-9]+_[0-9]+_[0-9]+_, this_.last_updated as last_upd[0-9]+_[0-9]+_[0-9]+_, tags3_.post_tags_id as post_tag[0-9]+_[0-9]+_, tags_alias1_.id as tag_id[0-9]+_[0-9]+_, tags_alias1_.id as id[0-9]+_[0-9]+_[0-9]+_, tags_alias1_.version as version[0-9]+_[0-9]+_[0-9]+_, tags_alias1_.name as name[0-9]+_[0-9]+_[0-9]+_ from post this_ inner join post_tag tags3_ on this_.id=tags3_.post_tags_id inner join tag tags_alias1_ on tags3_.tag_id=tags_alias1_.id where tags_alias1_.id=\\?\n'
If you look at the second query, you can see it queried for more properties than were specified in the original query, and if you debug the actual test, you'll see that env.fetchArguments is always an empty Map. Hence the test is incorrect, given the actually expected behavior.
So either that is intended (and arguably not very useful) and the docs are misleading, or the docs are correct and this is actually not functioning as intended.
The text was updated successfully, but these errors were encountered:
Took another look at this tonight and I'm not sure what I was doing wrong earlier but I'm seeing the fetchArguments correctly now when debugging. Closing for now at least.
Reopening this as it appears that fetchArguments is always null when using the property dsl to modify a current properties dataFetcher, but appears to be working correctly when using the add dsl.
When defining a custom property/field, the docs say we can use the provided
fetchArguments
for retrieving the fetch options or the list of join properties. However, it's perpetually empty, and hence we lose out on the automatic join operations.Oddly enough, the test for this functionality appears to actually confirm this:
gorm-graphql/examples/grails-test-app/src/integration-test/groovy/grails/test/app/TagIntegrationSpec.groovy
Lines 110 to 130 in 5149504
If you look at the second query, you can see it queried for more properties than were specified in the original query, and if you debug the actual test, you'll see that env.fetchArguments is always an empty Map. Hence the test is incorrect, given the actually expected behavior.
It appears this is the root cause:
gorm-graphql/core/src/main/groovy/org/grails/gorm/graphql/entity/EntityFetchOptions.java
Lines 213 to 215 in 5149504
So either that is intended (and arguably not very useful) and the docs are misleading, or the docs are correct and this is actually not functioning as intended.
The text was updated successfully, but these errors were encountered: