apache / apache/grails-core

Domain subclass does not inherit caching from parent

Open
#14,352 1 comment 0 reactions 0 assignees View on GitHub
relates-to: grails-data-hibernate5
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

In grails 2, applying cache true in a parent domain class's mapping block would propagate 2nd level caching through to the child domains, this is not the case with grails 4.
This results in attempted retrievals and misses from the cache for the child domain.
The linked sample project displays this behaviour by setting up a Parent and Child domain & calls to both dynamic finder and criteria queries through loading of the index page.
The logged session statistics show that the domain details never seem to be put into the cache.

A non-abstract domain (StandardThing) is also configured to ensure the correct behaviour which can be accessed through the relevant URI.

Sample app
https://github.com/leadtrip/grail4AbstractCache

Contributor guide

Open the contributing guide

Research direction

Start with the linked sample app and its Parent, Child, and StandardThing domain classes. Reproduce the dynamic finder and criteria queries from the index page while checking the logged session statistics. Done means child-domain details are cached and subsequent retrievals no longer miss as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.