org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘dataTime’ in ‘class com.dto.UserDto’
问题分析:1、Mapper文件中参数出现了dataTime,但是实体类UserDto中却没有dataTime,两边无法映射导致报错。
INSERT INTO t_user(user_id,user_name,data_time) VALUES (#{item.userId,item.userName,item.dataTime}) public class UserDto { private Long userId; private String userName; }
解决办法:
(1)Mapper文件去掉dataTime,实体类保持不变。
INSERT INTO t_user(user_id,user_name) VALUES (#{item.userId,item.userName})
(2)实体中添加dataTime,Mapper文件保持不变。
public class UserDto {
private Long userId;
private String userName;
private Date dataTime;
}



