hibernate缓存机制要清理,不然要重启服务器才能更新出来
写法:红色两句话要加
Session session = null;
try {
session = openSession();
String sql = "select person.personName, person.orgName, person.worktel, person.mobile, person.email"
+ "from EIP_PERSON person ";
if(name != null && name != "") {
sql += " where person.personName like '%" + name + "%' and person.orgName like '%" + name + "%' ";
}
Query q = session.createSQLQuery(sql);
List list = QueryUtil.list(q, getDialect(), begin, end);
session.flush();
return list;
} catch (Exception e) {
throw HibernateUtil.processException(e);
} finally {
closeSession(session);
FinderCache.clearCache(EipPerson.class.getName());
}