开发者

How to invalidate / refresh a domain instance association?

开发者 https://www.devze.com 2022-12-23 01:03 出处:网络
There is a bug in Grails preventing me from using removeFrom* when the node I\'m trying to remove is extending the 开发者_如何学Ccollection type. Removing the node directly from the association won\'t

There is a bug in Grails preventing me from using removeFrom* when the node I'm trying to remove is extending the 开发者_如何学Ccollection type. Removing the node directly from the association won't update the second level cache.

A hasMany B

Is there any way to manually invalidate or force a reload on an association cache? Invoking refresh() on the many side didn't do the trick.


If you have access to the SessionFactory instance, you could use evictCollection:

sessionFactory.evictCollection("Cat.kittens", catId); //evict a particular collection of kittens
sessionFactory.evictCollection("Cat.kittens"); //evict all kitten collections
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号