1. 程式人生 > 程式設計 >解決myBatis返回integer值的問題

解決myBatis返回integer值的問題

經過測試

resultMap="java.lang.Integer"

改成

resultType="java.lang.Integer"

也可以解決問題~

補充知識:mybatis返回count(*)的整數值

1、mybatis中resultType定義為"java.lang.Integer"

<select id="selectNums" resultType="java.lang.Integer">
 select count(*) from tableName
 </select>

2、介面中返回值寫成int,即可

int selectNums();

以上這篇解決myBatis返回integer值的問題就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支援我們。