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
Using dynamic finders for properties of java.time.Year type in test code results in InvalidDataAccessResourceUsageException - Cannot query (...) on non-existent property: (...), while in regular code it works fine.
Debugging had shown that java.time.Year is not recognized as a simple type in MappingFactory.
Task List
Steps to reproduce provided
Stacktrace (if present) provided
Example that reproduces the problem uploaded to Github
Full description of the issue provided (see below)
Steps to Reproduce
Create domain class with property of type java.time.Year (e.g. year)
In unit test use dynamic finder with the java.time.Year property (findByYear())
Expected Behaviour
Dynamic finder should work as in non-test code.
Actual Behaviour
Using dynamic finder throws exception:
org.springframework.dao.InvalidDataAccessResourceUsageException: Cannot query [sandbox.TestDomain] on non-existent property: year
at org.grails.datastore.mapping.simple.query.SimpleMapQuery.getValidProperty(SimpleMapQuery.groovy:751)
at org.grails.datastore.mapping.simple.query.SimpleMapQuery.executeSubQueryInternal(SimpleMapQuery.groovy:690)
at org.grails.datastore.mapping.simple.query.SimpleMapQuery.executeSubQuery(SimpleMapQuery.groovy:676)
at org.grails.datastore.mapping.simple.query.SimpleMapQuery.executeQuery(SimpleMapQuery.groovy:63)
at org.grails.datastore.mapping.query.Query.doList(Query.java:575)
at org.grails.datastore.mapping.query.Query.singleResult(Query.java:563)
at org.grails.datastore.gorm.finders.AbstractFindByFinder.invokeQuery(AbstractFindByFinder.java:35)
at org.grails.datastore.gorm.finders.AbstractFindByFinder$1.doInSession(AbstractFindByFinder.java:29)
at org.grails.datastore.mapping.core.DatastoreUtils.execute(DatastoreUtils.java:319)
at org.grails.datastore.gorm.finders.AbstractFinder.execute(AbstractFinder.java:42)
at org.grails.datastore.gorm.finders.AbstractFindByFinder.doInvokeInternal(AbstractFindByFinder.java:27)
at org.grails.datastore.gorm.finders.DynamicFinder.invoke(DynamicFinder.java:174)
at org.grails.datastore.gorm.finders.DynamicFinder.invoke(DynamicFinder.java:374)
at org.grails.datastore.gorm.GormStaticApi.methodMissing(GormStaticApi.groovy:173)
at org.grails.datastore.gorm.GormEntity$Trait$Helper.staticMethodMissing(GormEntity.groovy:749)
at sandbox.TestDomainSpec.Dynamic finder should work with java.time.Year(TestDomainSpec.groovy:16)
Using dynamic finders for properties of java.time.Year type in test code results in
InvalidDataAccessResourceUsageException
-Cannot query (...) on non-existent property: (...)
, while in regular code it works fine.Debugging had shown that java.time.Year is not recognized as a simple type in MappingFactory.
Task List
Steps to Reproduce
year
)findByYear()
)Expected Behaviour
Dynamic finder should work as in non-test code.
Actual Behaviour
Using dynamic finder throws exception:
Environment Information
Example Application
GitHub repository: https://github.com/piotrgajow/Sandbox
Branch:
grails-JavaTimeYearPropertyIssue
- https://github.com/piotrgajow/Sandbox/tree/grails-JavaTimeYearPropertyIssueNotable files:
Domain class.
Finder working properly in Bootstrap.
Finder not working in test code.
The text was updated successfully, but these errors were encountered: