控制臺報(bào)的SQL語法錯(cuò)誤,很奇怪
自己在DEBUG模式下運(yùn)行,程序執(zhí)行到MaintainService下的deleteBatch下的dao.deleteBatch(idList)就報(bào)錯(cuò)
下面是報(bào)錯(cuò)的部分信息:
<==????? Total: 3
==>? Preparing: delete form MESSAGE where ID in( ? , ? )
==> Parameters: 2(Integer), 3(Integer)
二月 07, 2017 3:38:37 下午 org.apache.catalina.core.StandardWrapperValve invoke
嚴(yán)重: Servlet.service() for servlet [com.sgu.tj.servlet.DeleteBatch] in context with path [/MyBatis] threw exception
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 'MESSAGE where ID in(? 2 , 3 )' at line 1
### The error may involve Message.deleteBatch-Inline
### The error occurred while setting parameters
### SQL: delete form MESSAGE where ID in(? ? , ? )
### 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 'MESSAGE where ID in(? 2 , 3 )' at line 1
2017-02-07
找到問題所在了,原因是sql語句寫錯(cuò)了應(yīng)該是from 寫成了 form
總結(jié)3點(diǎn)想分享給一起努力小伙伴:1.學(xué)會使用DEBUG,這是個(gè)好東西
2.心細(xì)
3.遇到一時(shí)解決不了的問題,學(xué)會像別人求助或者放一下,讓自己休息一下再來看,效率會高很多。