So for the set children, should we specify the region org.demo.parent.children where it should cache the association or should we use the cache region of org.demo.children where the children would be getting cached.
I am using EHCache as the 2nd level cache provider. I tried to search for the answer to this question but couldnt find any answer in this direction. It makes more sense to use org.demo.children but I dont know in which scenarios one should use a separate cache region for associations/sets/collections as in the above case. Kindly provide your inputs also let me know if I am not clear in my question.
I was more concerned about the consistency. In the above case we have different cache regions for children namely as org.demo.parent.children and org.demo.children then if one of them is updated the other one would not reflect that change. So will this not affect the consistency or shall the changes be propagated everywhere?? Kindly clarify this.
Doesn't the above configuration kind of mean that we shall have 2 cache regions for the same table/class??
Also my understanding of the above scenario is like this
org.demo.parent cache region will be something like this in dehydrated form:
id - name - {children ids} ::: These {children ids would point towards the org.demo.parent.children cache region and NOT to org.demo.children }
org.demo.parent.children will be smthng like this
id - name - parent_id
there would also be org.demo.children cache region which would be like org.demo.parent.children cache region but will be entirely different from it:
id - name - parent_id
Doesn't this kind of lead to redundancy and thereby inconsistency if one the regions is updated? Should then the associations then be mapped to the same table (example: to org.demo.children in the above case) to which they belong when caching them?