SSH批量更新getHibernateTemplate().bulkUpdate(hql)

当用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"/>

项目就正常运行.

你可能感兴趣的:(批量更新)