You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by "jacobmarcus (via GitHub)" <gi...@apache.org> on 2025/04/17 16:36:11 UTC

[I] Closure for creating key has an issue when used with @Transactional annotation [grails-core]

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

   This issue is related to https://github.com/grails-plugins/grails-cache/issues/49. 
   
   grails -v
   _Grails Version: 3.3.7
   Groovy Version: 2.4.15
   JVM Version: 1.8.0_222_
   
   The following service method will give the stacktrace below. Issue is with how the key is formed. 
   It works without the @Transactional annotation. Version of cache plugin is **4.0.3**.
   
   ```
       @Transactional(readOnly=true)
       @Cacheable(value='codes', key={code + '' + layer})
       def getCachedData(String code, String layer){
         return 'some code'
       }
   ```
   
   Caused by: java.lang.NoSuchMethodError: java.lang.String.plus(Ljava/lang/CharSequence;)Ljava/lang/String;
           at helloworld.SimpleService$__tt__getCachedData_closure4.doCall(SimpleService.groovy:89)
           at grails.plugin.cache.CustomCacheKeyGenerator.generate(CustomCacheKeyGenerator.groovy:115)
           at grails.gorm.transactions.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:94)
           at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
   
   


-- 
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: commits-unsubscribe@grails.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org