public abstract class BaseHibernateDao<E, PK extends Serializable> extends HibernateDaoSupport implements
EntityDao<E, PK> {
public List<DocumentUser> getByDocTransferId(Long id) {
//1.
String hql = "from DocumentUser where doctransferId=" + id;
return this.getHibernateTemplate().find(hql);
}
public void deleteUserByDoctransferId(Long id) {
// 2. List<DocumentUser> ls = getByDocTransferId(id);
// for (DocumentUser du : ls) { // delete(du); // }
---------------------------------------------------------------------------------------------
//一步完成删除操作
getSession().createQuery("delete DocumentUser where doctransferId="+ id).executeUpdate();
}