mybatis报错:A query was run and no Result Maps were found for the Mapped Statement..

mybatis报错:[A query was run and no Result Maps were found for the Mapped Statement ‘*‘. It’s likely that neither a Result Type nor a Result Map was specified.

mapper.xml

<insert id="insert" parameterType="*.*.*TbSpecification" >
<selectKey keyProperty="id" order="AFTER" keyColumn="id" >
    SELECT LAST_INSERT_ID() AS id
</selectKey>
    insert into tb_specification (id, spec_name)
    values (#{id,jdbcType=BIGINT}, #{specName,jdbcType=VARCHAR})
  </insert>

在seelctkey后面添加resultType=”java.lang.Long” 就不报错了.
总结:select 查询的要有resultType,insert有默认的int 类型返回受影响的行,如果使用Integer 与Long,long 类型接收它会出现

Servlet.service() for servlet [springmvc] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.NoSuchMethodError: com.pinyougou.mapper.TbSpecificationMapper.insert(Lcom/pojo/TbSpecification;)I] with root cause  /*///////////包名变成Lcom............?*/
java.lang.NoSuchMethodError: com.pinyougou.mapper.TbSpecificationMapper.insert(Lcom/pinyougou/pojo/TbSpecification;)

猜你喜欢

转载自blog.csdn.net/weiqiang_java/article/details/81409475