Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个自定义属性访问器,它在我的对象上设置它之前修改一个值。问题是对象被检测为脏。有没有办法重置对象的脏度?
可能你需要的是使用@Access(AccessType.FIELD)
@Access(AccessType.FIELD)
例如
@Access(AccessType.FIELD) public String getStringValue() { return this.stringValue != null ? stringValue : ""; }
在这种情况下,Hibernate 将使用字段值而不是 getter 进行脏检查。