我有一个映射器方法来删除表中的所有记录。但首先我需要删除关联连接表中的所有记录。这是我尝试过的:
@Delete("delete from COC_BLOCK_FIELD; delete from COC_BLOCK;")
void deleteBlocks();
这看起来很合理,但 MyBatis 在处理我的映射器时抛出异常:
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delete from COC_BLOCK' at line 1
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: delete from COC_BLOCK_FIELD; delete from COC_BLOCK;
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delete from COC_BLOCK' at line 1
我正在使用 MyBatis 3.2.6、MySQL 5.5.35-1ubuntu1 和 MySQL Connector 5.1.26。
问题是我没有设置标志allowMultiQueries=true
在 JDBC URL 中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)