Cause: java.sql.SQLException: Zero date value prohibited
阿新 • • 發佈:2021-01-20
使用mybaits XML檔案寫SQL語句或呼叫儲存過程輸出列表中,如果包含date型別的資料:如:
<select id="getList" resultType="com.bjwl.modules.paint.entity.PaintLifeEntity">
SELECT RECID,FCODE,CONTACT,FADDR,FADMINMAPNM,FLNG,FLAT,FCreateTM
FROM tsvbase
<if test="ew.emptyOfWhere==false" >
${ew.customSqlSegment}
</if>
<select>
系統報如下錯誤:
org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column ‘FCREATETM’ from result set. Cause: java.sql.SQLException: Zero date value prohibited
原因:FCREATETM為Date型別,資料庫資料為
“0000-00-00”轉換失敗
解決辦法1
解決方法2:確保每條記錄日期型別欄位中有正確的資料