首页 > 解决方案 > MyBatis / Srping-Boot Mapper 方法试图从具有原始返回类型 (int) 的方法返回 null

问题描述

我正在使用MyBatis / Spring-Boot

我正在学习它:)

我收到此错误消息:

Mapper 方法尝试从具有原始返回类型 (int) 的方法返回 null

在论坛中不同建议的帮助下,我尝试了不同的方式来编写它。没有工作

有代码:

    @Select("INSERT INTO TB_Users(userId, firstName, lastName) VALUES( #{userId}, #{firstName}, #{lastName})")
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    public int save(UserEntity userEntity);

谢谢你的帮助

标签: spring-bootmybatis

解决方案


推荐阅读