1. 程式人生 > >Mybatis錯誤:No enum constant org.apache.ibatis.type.JdbcType.number

Mybatis錯誤:No enum constant org.apache.ibatis.type.JdbcType.number

No enum constant org.apache.ibatis.type.JdbcType.number

按照這個報錯的資訊,我的理解是:org.apache.ibatis.type.JdbcType中沒有number型別的常量。

好吧,應該是oracle中的型別常量number與mybatis中對應的型別常量是不一樣的,通過檢視 該文章 幫助我解決了該問題。

通過 該文章,發現Mybatis中jdbcType的整數型別應該為NUMERIC,而不是oracle中的整形NUMBER,這種情況應該是我覺得是為了應對多資料庫的原因把。

<sql id="failureRequestValue">
        #{id, jdbcType=NUMERIC},
        #{current_date, jdbcType=VARCHAR},
        #{current_hour, jdbcType=NUMERIC},
        #{current_min, jdbcType=NUMERIC},
        #{error_message, jdbcType=VARCHAR}      
</sql>

那麼,將oracle中的NUMBER型別對應Mybatis中的jdbcType的NUMERIC。這樣就沒有報錯了。

參考文章:https://blog.csdn.net/loongshawn/article/details/50496460