RNiesler opened a new issue, #14472:
URL: https://github.com/apache/grails-core/issues/14472

   The cache setting given inside the criteria: 
   ```
   final criteria = Entity.createCriteria()
   final result = criteria.list([:]) {
     cache(false)
   }
   ```
   is overwritten by the setting in the domain mapping:
   ```
   class Entity {
     String field1
     static mapping = {
       cache usage: 'nonstrict-read-write', include: 'all'
     }
   }
   ```
   Responsible for this behavior is 
`GrailsHibernateUtil.populateArgumentsForCriteria` method and more specifically 
`GrailsHibernateUtil.cacheCriteriaByMapping` which looks into domain class 
mapping and if the cache is enabled there it would set it to true in the 
criteria. As a workaround I have to use the argument to `list` instead: 
   ```
   criteria.list([cache: false]) {
   }
   ```
   
   Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to