Mybatis测试SQL语句的时候报错attempted to return null from a method with a primitive return type (int)
在写SQL语句的时候,写插入语句无论如何也无法执行。
报错内容:
语句是这样
<select id="addUser" parameterType="com.gyh.entity.User" resultType="int">
insert into user(id,name,password) values (#{id},#{name},#{password});
</select>
后来经过仔细检查,发现是写错了标签,手抽写成了select,正确的应该是
<insert id="addUser" parameterType="com.gyh.entity.User">
insert into user(id,name,password) values (#{id},#{name},#{password});
</insert>