当前使用版本(必填,否则不予处理)

jdk: 17 mybatis: 3.5.3.1

该问题是如何引起的?(确定最新版也有问题再提!!!)

  1. 创建一个普通的record 对象
  2. 然后通过 xml ,mapper 进行数据操作

重现步骤(如果有就写完整)

  1. 创建class 并且创建别名的get 方法 @TableName(value = "device") public record Device(String id,String name){

    public String getId(){ return id(); }

    public String getIdStr(){ return getId(); }

public String getName(){ return name(); } }

  1. 通过基础的mapper操作
  2. 通过xml 操作
<insert id="saveBatchEvent" parameterType="list">
        insert into device (id,name)
        values
         <foreach collection="list" index="index" item="item"  separator=",">
             (#{item.idStr}, #{item.name})
         </foreach>
    </insert>

报错信息

  • There is No setter found for property named 'id' in 'xxxx
  • There is No getter found for property named 'idStr' in 'xxxx

Comment From: wxiao1002

是不是mybatis 问题?

Comment From: miemieYaho

和mp无关

Comment From: Terrdi

哪个版本没有这个问题?