SSH批量更新getHibernateTemplate().bulkUpdate(hql)
2012-04-16 10:48
453 查看
当用getHibernateTemplate().bulkUpdate(hql)这个方法是会报错.
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute update query; uncategorized SQLException for SQL [update lring3.users set password=? where deptid=1]; SQL state [S1009]; error code [0]; Connection is read-only. Queries leading to data modification are not allowed; nested exception is java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
是因为在为spring配置事务时
<tx:method name="*" propagation="REQUIRED" read-only="true" />
将read-only="true"即:
<tx:method name="*" propagation="REQUIRED"/>
项目就正常运行.
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute update query; uncategorized SQLException for SQL [update lring3.users set password=? where deptid=1]; SQL state [S1009]; error code [0]; Connection is read-only. Queries leading to data modification are not allowed; nested exception is java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
是因为在为spring配置事务时
<tx:method name="*" propagation="REQUIRED" read-only="true" />
将read-only="true"即:
<tx:method name="*" propagation="REQUIRED"/>
项目就正常运行.
相关文章推荐
- getHibernateTemplate().update()方法执行后需flush,否则无法更新
- SSH利用getHibernateTemplate().update更新所需要更新的部分字段
- getHibernateTemplate().saveOrUpdate(t)不能更新
- getHibernateTemplate().update()方法更新不了解决办法
- Hibernate hql getHibernateTemplate()常用方法汇总
- Spring 中常用的hql查询方法(getHibernateTemplate())
- Hibernate HQL查询 插入 更新(update)实例
- Spring中常用的hql查询方法(getHibernateTemplate())
- Spring中常用的hql查询方法(getHibernateTemplate())
- Gethibernatetemplate的查询更新以及批量操作方法
- J2EE进阶(十七)Hibernate中常用的HQL查询方法(getHibernateTemplate())
- Spring中常用的hql查询方法 (getHibernateTemplate())
- Spring中常用的hql查询方法 (getHibernateTemplate())
- Hibernate hql getHibernateTemplate()常用方法汇总
- getHibernateTemplate().saveOrUpdateAll(list)只保存了最后一条
- Spring中常用的hql查询方法(getHibernateTemplate())(转)
- Spring 中常用的hql查询方法(getHibernateTemplate())
- 在Spring使用getHibernateTemplate().save()为何不能更新数据库
- J2EE进阶(十七)Hibernate中常用的HQL查询方法(getHibernateTemplate())
- Spring中常用的hql查询方法(getHibernateTemplate())