在ssh项目中写了一个update方法,然后报错,找了挺久。
后来发现是违反了事务。。。 我方法中的方法名写的是develop,把它改成updateDevelop,就可以了。
public Integer develop(int chc_id) { return this.getHibernateTemplate().execute(new HibernateCallback<Integer>() { @Transactional @Override public Integer doInHibernate(Session session) throws HibernateException { // TODO Auto-generated method stub String hql = "update Chance set chc_status=3 where chc_id="+chc_id; Query query = session.createQuery(hql); // int executeUpdate = query.executeUpdate(); return query.executeUpdate(); } }); } |