Unsupported conversion from DATETIME to java.lang.Integer

前端在向后端发请求查询数据的时候,前端开发者工具提示界面报500的错误,后端run界面显示报错信息
以下是报错的部分提示信息

com.mysql.cj.exceptions.DataConversionException: Unsupported conversion from DATETIME to java.lang.Integer
	at com.mysql.cj.result.DefaultValueFactory.unsupported(DefaultValueFactory.java:70) ~[mysql-connector-java-8.0.26.jar:8.0.26]

出现这个错误原因,是因为我的数据库视图表中,在查询语句时,先查询的是时间,然后才是其它类型的数据,具体语句如下所示

select distinct `order`.`otime` AS `otime`,`order`.`oid` AS `oid`,`order`.`sum` AS `sum`,`order`.`cid` AS `cid`,`business`.`bname` AS `bname`,`rider`.`rname` AS `rname`,`delivery`.`detime` AS `detime`,`delivery`.`deidt` AS `deidt`,`address`.`address` AS `address`,`address`.`acontact` AS `acontact`,`address`.`aphone` AS `aphone` from ((((`address` join `order` on((`address`.`aid` = `order`.`aid`))) join `business` on((`order`.`bid` = `business`.`bid`))) join `delivery` on((`order`.`oid` = `delivery`.`oid`))) join `rider` on((`delivery`.`rid` = `rider`.`rid`)))

将时间类放到其它类型的数据之后,前端界面刷新,再次运行就解决上述问题了,具体SQL语句如下所示

select distinct `order`.`oid` AS `oid`,`order`.`otime` AS `otime`,`order`.`sum` AS `sum`,`order`.`cid` AS `cid`,`business`.`bname` AS `bname`,`rider`.`rname` AS `rname`,`delivery`.`detime` AS `detime`,`delivery`.`deidt` AS `deidt`,`address`.`address` AS `address`,`address`.`acontact` AS `acontact`,`address`.`aphone` AS `aphone` from ((((`address` join `order` on((`address`.`aid` = `order`.`aid`))) join `business` on((`order`.`bid` = `business`.`bid`))) join `delivery` on((`order`.`oid` = `delivery`.`oid`))) join `rider` on((`delivery`.`rid` = `rider`.`rid`)))

目前这个问题,解决方法,我只找到了这一种,如果还有其它的解决方法,欢迎各位大神在评论区评论

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值