我有一个实体产品和实体内部,我有 Contry 实体。
当我执行 Product.find 或 Product.get 并获取国家/地区值时,我的国家/地区值只有 id 值,但在国家实体中,我有 id、名称和代码 [id: 1, code:null, name:null],但这情况是间歇性的,99% 的时间值被加载 [id:1, code: XXX, name:YYYYY]。
我认为这是一个缓存问题,但我不在开发人员环境中模拟,只是在生产环境中
我的国家域名:
class Country implements Serializable {
private static final long serialVersionUID = 1
def i18NService
String name
String code
static mapping = {
cache true
}
Country(String code, String name) {
this()
this.name = name
this.code = code
}
这是一个 grails/hibernate 缓存错误?我如何模拟这种情况?