如果我在对象类中有这个方法:
@OneToMany( fetch = FetchType.EAGER,
cascade = { CascadeType.ALL },
mappedBy = "object" )
@org.hibernate.annotations.Cascade(
{org.hibernate.annotations.CascadeType.SAVE_UPDATE})
@Column( nullable = false )
public Set<ObjectEntry> getObjectEntries() {
return this.objectEntries;
}
我穿上@cache
又ObjectEntry
穿上Object
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Object extends HashCodeValidator {
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ObjectEntry extends HashCodeValidator
我是否还需要像这样将@cache 放在 getObjectEntries 上:
@org.hibernate.annotations.Cascade(
{org.hibernate.annotations.CascadeType.SAVE_UPDATE})
@Column( nullable = false )
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public Set<ObjectEntry> getObjectEntries() {
return this.objectEntries;
}
如果我特别添加,是否需要为每个查询定义缓存
hibernate.cache.use_query_cache = true
?