当前位置: 移动技术网 > IT编程>数据库>Mysql > mybatis批量新增报错 BadSqlGrammarException

mybatis批量新增报错 BadSqlGrammarException

2019年10月11日  | 移动技术网IT编程  | 我要评论

org.springframework.jdbc.badsqlgrammarexception:
### 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 '' at line 7
### the error may involve com.yks.eco.dao.ecostaffdao.insertbatch-inline
### the error occurred while setting parameters
### sql: insert into ykseco.eco_staff (name,userid, order_in_depts, unionid, position, mobile, tel, work_place, remark, email, org_email, jobnumber, is_hide, is_admin, is_boss, is_leader, active, hired_date, avatar, extattr, user_code, creater, create_date, modifier ) values
### 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 '' at line 7
; bad sql grammar []; nested exception is 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 '' at line 7
at org.springframework.jdbc.support.sqlerrorcodesqlexceptiontranslator.dotranslate(sqlerrorcodesqlexceptiontranslator.java:231)
at org.springframework.jdbc.support.abstractfallbacksqlexceptiontranslator.translate(abstractfallbacksqlexceptiontranslator.java:73)
at org.mybatis.spring.mybatisexceptiontranslator.translateexceptionifpossible(mybatisexceptiontranslator.java:74)
at org.mybatis.spring.sqlsessiontemplate$sqlsessioninterceptor.invoke(sqlsessiontemplate.java:399)
at com.sun.proxy.$proxy22.insert(unknown source)

 

注意:sql语句在values之后就没有了,这是由于传入的list集合为空,请检查代码!

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网