我正在尝试实现以下IBATIS插入注释,但请继续获取以下错误消息:
org.apache.ibatis.binding.bindingexception:参数"人"不 成立。可用参数为[arg1,arg0,param1,param2]
这是我到目前为止的代码。我该如何修复?
@(Insert("INSERT INTO profile (person, school) VALUES (#{person}, #{school})";)
void insertOne(TestTextMessage person, String school)
一些上下文:
尝试了此... @(Insert("INSERT INTO profile (person, school) VALUES (#{arg0}, #{arg1})";)
,但是立即获得Java.lang.sertion错误。TestTextMessage是包含以下值的类:
@Data
@NoArgs
@EqualsAndHashCode
public class TestTextMessage {
private long id;
private String name;
private int age;
}
目前我这样称呼:
messageMapper.insertOne(new TestTextMessage(person1), SchoolType.EDENGLEN);
如果我将学校类型移至班级,那么它应该有效,但是如何为学校类型分配一个价值?
使用arg0
和arg1
@(Insert("INSERT INTO profile (person, school) VALUES (#{arg0}, #{arg1})")
或
使用@Param
给参数一个名称。
void insertOne(@Param("person")TestTextMessage person, @Param("school") String school)