You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@grails.apache.org by "jamesfredley (via GitHub)" <gi...@apache.org> on 2026/10/02 08:06:01 UTC

Re: [I] Domain subclass does not inherit caching from parent [grails-core]

jamesfredley commented on issue #14352:
URL: https://github.com/apache/grails-core/issues/14352#issuecomment-5947881027

   Confirmed on `8.0.x` at `d13aa332`.
   
   A subclass mapping now copies the parent’s second-level cache flag. Hibernate takes the cache concurrency strategy from the root class, and the missing flag was what kept child lookups out of the cache.
   
   Hibernate 5 sets it in `grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java` with `subClass.setCached(parent.isCached())`. Hibernate 7 does the same in `grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/SubclassMappingBinder.java`. The parent root still receives the strategy from the domain `cache` mapping before subclasses are bound.
   
   That assignment was added in `b45f955f9` (2022-01-20), “Second level cache not working for inherited domains”, which is https://github.com/grails/gorm-hibernate5/pull/483. In this repository the commit is in `v7.0.0-M4` and the later 7.0, 7.1, and 7.2 tags except `v7.0.16`, and in `v8.0.0-M1` through `v8.0.0-RC2`.
   


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

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