@Transactional(propagation=Propagation.REQUIRED,isolation=Isolation.DEFAULT)
public void updateStatus(User user,Integer roleId) {
Role r = roleDao.getRoleById(roleId);
Set<Role> roles = new HashSet<Role>();
roles.add(r);
user.setRoles(roles);
if (user.getStatus()==1) {
user.setStatus(0);
}else{
user.setStatus(1);
}
user.setSex("F"); userDao.updateStatus(user);
}上面是Service方法的代码,执行的是修改用户状态的操作
解决方案 »
- jdbc查询数据库报:java.sql.SQLException: ORA-01006: 绑定变量不存在
- el表达式取值
- 我用的是Tomcat5.5,数据源配置与代码应该都没问题但是连不上数据源这是为什么?急!!
- frameset 重复显示的问题
- strut2中的dispatcher问题
- 为什么jsp程序无反应????
- 请问一下如何在jsp里面动态生成table?谢谢了!
- SOS,,各位看到的帮帮我!!!!!中午就要交了.在线ING....提示window.myform.no为空或不是对象
- 那里有java的帮助手册下载?类似于萎软的msdn
- tomcat 如何配置 servlet
- 求好用的基于java的CMS框架
- 试用期新人请各位大神帮忙指点(extjs grid)
将事物交给 Spring 管理,事物是自动提交和回滚的
JDBC exception on Hibernate data access: SQLException for SQL [update SYS_USER set age=?, email=?, joinDate=?, name=?, outDate=?, password=?, phone=?, registerDate=?, sex=?, USER_STATUS=?, USER_NAME=? where USER_ID=?]; SQL state [72000]; error code [1407]; Could not execute JDBC batch update; nested exception is org.hibernate.QueryTimeoutException: Could not execute JDBC batch update使用FireBug查看响应报错
对象参数
User [userId=24, userName=null, name=null, password=null, sex=M, age=0, status=0, email=null, phone=null, joinDate=null, outDate=null, registerDate=Mon Feb 09 15:25:36 CST 2015, roles=[org.ecsys.po.Role@54275294], roleLimits=[]]数据库userName字段约束不能为空
是不是hibernateTemplate.update()方法接受的参数对象跟数据库冲突了
/**
* 改用户状态
* @param user
*/
public void updateStatus(final User user) {
System.out.println(user.toString());
hibernateTemplate.update(user);
}DAO层的代码