Hibernate - hql语句修改部分字段

 

Dao中的封装方法如下:
public int update(final String hql, final Object[] params){
   return super.getHibernateTemplate().bulkUpdate(hql, params);
}

 

Action 中的调用方法如下:
String hql = "update BlogSetting b set b.title=?, b.describale=? where b.id=?";
int n = blogSettingService.update(hql, new Object[]{s.getTitle(), s.getDescribale(), s.getId()});

 

posted @ 2012-12-06 21:36  戴眼镜的码农  阅读(2518)  评论(0编辑  收藏  举报