- 1.
List list = this.getHibernateTemplate().find("from VGisMonth as gismonth where to_char(gismonth.visittime,'YYYY-MM-DD') = '"+strFromTime+"'");
if(list.size()>0){
this.getHibernateTemplate().deleteAll(list);
}
- Hibernate3 里对批量删除已推荐使用 createQuery(hql)了 .
这样,如果量大的话能大幅提高删除效率!
如:
hql = "delete Customer where name = :oldName";
int deleteEntities = session.createQuery(hql)
.setString("oldName",oldName)
.executeUpdate();