
public void updateByPersonOid(List<String> personOidList) throws DataAccessException ...{
StringBuffer hql = new StringBuffer();
// hql.append("update Info w set w.Birthday=:Birthday where w.personOid=:personOid");
hql.append("update Info w set w.FeeUsage=:FeeUsage where w.personOid in (:personOidList)");
Query query = getSession().createQuery(hql.toString());
query.setString("FeeUsage", ENJOY);
//数据库中的personOid为number
query.setParameterList("personOidList", personOidList,new StringType());
query.executeUpdate();
}
本文介绍了一种使用Hibernate通过提供personOid列表来批量更新数据库中多个记录的方法。具体实现包括构造HQL更新语句并设置参数。
74

被折叠的 条评论
为什么被折叠?



