2014-04-20 1 views
2

테이블의 모든 레코드를 삭제하는 매퍼 메서드가 있습니다. 하지만 먼저 연관된 접합 테이블에서 모든 레코드를 삭제해야합니다. 이것은 내가 뭘하려 :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 등을 사용하고 있습니다 : 내 매퍼를 처리 할 때 합리적인 듯

@Delete("delete from COC_BLOCK_FIELD; delete from COC_BLOCK;") 
void deleteBlocks(); 

, 아직 MyBatis로 예외를 throw MySQL 커넥터 5.1.26.

답변

6

문제는 JDBC URL에 allowMultiQueries=true 플래그를 설정하지 않았기 때문입니다.

+0

내 문제가 해결되었습니다. 감사 –