`

MyBatis报Error setting null parameter 的解决方法

 
阅读更多

mybatis论坛解决:

http://code.google.com/p/mybatis/issues/detail?id=224&q=Error%20setting%20null%20parameter&colspec=ID Type Component Status Priority Version Target Summary Reporter

 

 

 

适配oracle数据库的时候,mybatis报了Error setting null parameter,bug发现是参数出现了null值,对于Mybatis,如果进行操作的时候,没有指定jdbcType类型的参数,就可能导致问题。

 

postgreSQL,MySQL,SQLSERVER都支持JdbcType.NULL类型,Oracle是不支持,适配的时候也因为这个问题导致mybatis报错。

 

 

比如,之前配置#{submitDate},它会在oracle中报错:Error setting null parameter

 

更改成#{submitDate,jdbcType=DATE},注意jdbcType是区分大小写的。

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics