当前位置:Gxlcms > 数据库问题 > SQL异常总结

SQL异常总结

时间:2021-07-01 10:21:17 帮助过:5人阅读

resultMap写错时,启动时就会报错

技术图片

 

 原因:

技术图片

 

 

2.The error occurred while handling results

### SQL: select USER_ID from user_dept   where COMP_ID=?

### Cause: java.lang.UnsupportedOperationException

原因:

技术图片

 

查询出来的是个List集合时,list元素是对象时resultType为对象(或者用resultMap),list元素为USER_ID这种时resultType用String,而不应该使用list

 

 

3.org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException

: Parameter ‘userIds‘ not found. Available parameters are [list]

技术图片

 

 

技术图片

 

 入参为List<String>类型,parameterType用String,需要的结果为List<String> ,resultType用String

 

 4.SQL: select USER_ID from audit_user where  AUDIT_TYPE=9 and ORG_ID=? and USER_ID in

 

; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax;

 

原因:

in() 时,输入的数组或集合必须不为空,否则报错,应该在业务层进行控制,为空时不能执行这条SQL 

 

 

 5.

技术图片

SQL异常总结

标签:nes   org   res   jdb   就会   image   HERE   mil   png   

人气教程排行