iBatis java.lang.RuntimeException: Error setting property

系统运行时报如下错误:
[java.sql.PreparedStatement]org.springframework.jdbc.UncategorizedSQLException: 

SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error 

code [0];   
--- The error occurred in com/windowclick/abb/ibatis/apkProduct.xml.  
--- The error occurred while applying a result map.  
--- Check the getApkProductDtoBySearch-AutoResultMap.  
--- The error happened while setting a property on the result object.  
--- Cause: java.lang.RuntimeException: Error setting property 'setShow_push_ad' of 

'com.windowclick.abb.dto.ApkProductDto@38daa6a6'.  Cause: 

java.lang.IllegalArgumentException; nested exception is 

com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in com/windowclick/abb/ibatis/apkProduct.xml. 


一看问题,以为是ApkProductDto对象中没有show_push_ad属性,被同事修改了,但实际正常,通过检查,发现 数据库中此列数据为空,但实际数据库设置此字段属性为INT类型,默认值为0,当查询转换时,不能把null转换成int类型,如此异常产生,如果实际应用中确实有空的数据,但需转换成其他类型,可以用ifnull(字段名,默认值)进行判断设置默认值

你可能感兴趣的:(iBatis java.lang.RuntimeException: Error setting property)