public void delete (int[] deleteKey) {
StringBuffer hql = new StringBuffer("delete Employee where employeeKey in (");
for (int i = 0; i < deleteKey.length; i++) {
if (i == 0) {
hql.append(deleteKey[i]);
} else {
hql.append(", ");
hql.append(deleteKey[i]);
}
}
hql.append(")");
final String hhql = hql.toString();
HibernateCallback action = new HibernateCallback() {
@Override
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
Query q = session.createQuery(hhql);
q.executeUpdate();
return null;
}
};
this.getHibernateTemplate().execute(action);
}
spring中使用hibernate
最新推荐文章于 2022-09-22 20:34:32 发布