Error setting properties ofibatis数据库不能为NULL

com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in sqlMap/google_campaigns.xml. 
--- The error occurred while applying a result map. 
--- Check the googleCampaigns.googleCampaignsResult. 
--- The error happened while setting a property on the result object. 
--- Cause: com.ibatis.common.exception.NestedRuntimeException: Error setting properties of 'com.tq365.vo.GoogleCampaigns@737371'.

 

ibatis做一对多关联时

报了这个错误,整了好久,到最后怀疑自己是不是学艺不精把数据关联弄错了,

改配置改了变天

仍是错。。。。

快要吐血了

今早起了个老早,google下

到最后发现是数据库有值为NULL的结果......

 

-----------------原因

ibatis 无法将 null 值赋给 Java 的 int 类型变量而产生的

-----------------解决方案

1、

在数据库允许为空的字段设置默认值,虽然工作量有点大

但保证不会出错

2、

[UserEmail] =#userEmail:VARCHAR#

 

[UserDescription] =#description:LONGVARCHAR#

添加上数据类型

原文地址:https://www.cnblogs.com/archie2010/p/1900879.html