控制台打印错误信息
org.springframework.dao.TransientDataAccessResourceException: Error attempting to get column 'title' from result set. Cause: java.sql.SQLException: Cannot convert value 'æ“作日志详æƒ
查询' from column 9 to TIMESTAMP. ; Cannot convert value 'æ“作
使用mybatisPlus,进行查询数据库字段类型也与实体类型一直,但是就是报错
public SysLog(String operationUser, String path, String time,
String parameter, String title, String action, Integer sysType, Integer opType,LocalDateTime createTime) {
super();
this.operationUser = operationUser;
this.path = path;
this.time = time;
this.parameter = parameter;
this.title = title;
this.action = action;
this.sysType = sysType;
this.opType = opType;
this.createTime = createTime;
}
最终发现原因,需要添加一个无参的构造方法就可以了
解决MybatisPlus查询时的Timestamp转换异常
文章描述了一次在使用MybatisPlus进行数据库查询时遇到的错误,具体是org.springframework.dao.TransientDataAccessResourceException,原因是尝试从结果集中获取title列时,遇到了将值æ“ä½œæ—¥å¿—è¯¦æƒæŸ¥è¯¢从列9转换为TIMESTAMP的错误。问题的解决方案是在实体类中添加一个无参数的构造方法。
4739

被折叠的 条评论
为什么被折叠?



