日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

iBatis resultMap出错 The error happened while setting a property on the result object 解决办法

發布時間:2024/4/17 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 iBatis resultMap出错 The error happened while setting a property on the result object 解决办法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

http://blog.csdn.net/itshu/article/details/3402253

錯誤:
org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL [];?

SQL state [null]; error code [0]; ?
--- The error occurred in com/sinosoft/para/conf/A_T_4_SqlMap.xml. ?
--- The error occurred while applying a result map. ?
--- Check the A_T_4.A_T_4Result. ?
--- The error happened while setting a property on the result object. ?
--- Cause: net.sf.cglib.beans.BulkBeanException; nested exception is?

com.ibatis.common.jdbc.exception.NestedSQLException: ?
--- The error occurred in com/sinosoft/para/conf/A_T_4_SqlMap.xml. ?
--- The error occurred while applying a result map. ?
--- Check the A_T_4.A_T_4Result. ?
--- The error happened while setting a property on the result object. ?

這個錯誤是resultMap里有問題。說錯誤發生在設置某一個屬性的時候,但是沒有具體說明是一個怎么樣的錯誤<NULL錯誤>。可能就

是把某一列中不為null的值賦了null值(double等),這樣的話在resultMap里面作修改就行了。
  肯定是iBatis試圖把從數據庫讀出來的NULL 值寫入對象屬性的時候出現異常。String類型的賦值應該沒問題,我的數據庫中還

有double類型的,那就是這個問題了,采取的補救措施就是:
?<result column="RATE" jdbcType="DECIMAL" property="rate" nullValue="0"/>
對從數據庫讀出來的NULL值采用一個相應可轉換為DECIMAL類型或者double類型的值來替換

附:
?
sqlMap:
<resultMap class="com.sinosoft.para.bean.A_t_4_6" id="A_T_4_6Result">
? <result property="id" column="user_id"/>
? <result column="RATE" jdbcType="DECIMAL" property="rate" nullValue="0"/>
? <!--這一行加一個nullValue="0"就OK了-->
?
</resultMap>

總結

以上是生活随笔為你收集整理的iBatis resultMap出错 The error happened while setting a property on the result object 解决办法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。