hibernate 中ehcache的Cache is not alive是什么问题?
现有有关联的两个对象,Province -> School 是one-to-many
获取Province的列表时,没有异常
获取School对象后,再来getProvince()时,发现异常:
INFO [thread-pool-24] (SchoolDAO.java:168) - getSchoolByQuery Exception : The com.sl.domainobject.Province Cache is not alive.
再回到去province list的方法,也有同样的异常:
代码:
public List findAll(){
try{
String sql = "select province from Province as province order by province.id asc";
List provinces = getHibernateTemplate().find(sql);
return provinces;
}catch(Exception e){
System.out.println("ProvinceDAO findAll Exception :" + e.getMessage());
e.printStackTrace();
}
return null;
};