【发布时间】:2018-11-19 11:44:25
【问题描述】:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'testStr' in 'class Test.TestModel'.
错误出现在以下方法中:
public interface TestMapper {
@Insert({"INSERT INTO PLUProps.Test VALUES(#{id}, #{testStr})"})
int insertData(TestModel testModel);
}
//Test
private int insertData(){
TestModel testModel = new TestModel();
testModel.setId(1);
testModel.setTestSTr("123123");
return testMapper.insertData(testModel);
}
在TestModel的实体类中,我使用lombok的@Data注解自动生成setter和getter方法。
@Data
public class TestModel implements Serializable {
private static final long serialVersionUID = -1180681799256416275L;
private int id;
private String testSTr;
}
这个错误是我写错了@Insert语句引起的吗?谢谢。
【问题讨论】:
标签: spring-boot mybatis