标签:方法 get microsoft his color ack 失败 use amp
hibernate自带update代码:(失效)
Session session = this.getSessionFactory().getCurrentSession(); ession.update(obj);
使用hql语句执行:
public void updateUser(String name, String tel,
String msg, Date date){
String hqlStr = "UPDATE User a" + " SET a.userName=? ," + " a.createTime=? ," + " a.phone=?, " + " a.backMsg=? " + " WHERE a.userId=?"; Session session = this.getSessionFactory().getCurrentSession(); session.createQuery(hqlStr).setString(0, name) .setTimestamp(1, date).setString(2, tel).setString(3, msg).setString(4, id).executeUpdate(); }
}
解决Hibernate4执行update操作,不更新数据的问题
标签:方法 get microsoft his color ack 失败 use amp
原文地址:http://www.cnblogs.com/klslb/p/7278937.html