java.sql.SQLException: Cannot set billDate: incompatible types.

An error suddenly appeared when I was running the code.

The error information is as follows.

Exception in thread "main" java.lang.RuntimeException: java.sql.SQLException: Cannot set billDate: incompatible types. Query: SELECT bill.*, NAME FROM bill, menu WHERE bill.menuId = menu.id Parameters: []
	at com.mhl.dao.BasicDAO.queryMulti(BasicDAO.java:56)
	at com.mhl.service.BillService.list2(BillService.java:53)
	at com.mhl.view.MHLView.listBill(MHLView.java:86)
	at com.mhl.view.MHLView.mainMenu(MHLView.java:247)
	at com.mhl.view.MHLView.main(MHLView.java:33)
Caused by: java.sql.SQLException: Cannot set billDate: incompatible types. Query: SELECT bill.*, NAME FROM bill, menu WHERE bill.menuId = menu.id Parameters: []
	at org.apache.commons.dbutils.QueryRunner.rethrow(QueryRunner.java:542)
	at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:399)
	at com.mhl.dao.BasicDAO.queryMulti(BasicDAO.java:53)
	... 4 more

I went looking for a solution to the error, and in the process I discovered that the date-time type used when the table was created was datatime, whereas the type defined in the code was data.

Then I drop the table named bill, and create it again.

I then re-added the data and displayed the bill, this time successfully getting the result.

相关推荐
Mr.JiuFen几秒前
【Tag name expected】-在mybatis-XML映射文件中无法使用小于号<的解决办法
xml·java·mybatis
风_流沙2 分钟前
【python基础】python中copy用法
开发语言·python
言之。7 分钟前
【微服务】6、限流 熔断
java·微服务·架构
水水阿水水19 分钟前
第二章:面向对象之封装(一)
开发语言·c++·算法
Yang-Never25 分钟前
Canvas->Bitmap绘制
android·java·开发语言·kotlin·android studio·idea
曦月合一38 分钟前
java中日期如何比大小
java·开发语言·后端
初学者丶一起加油1 小时前
C语言基础:野指针、空指针、空悬指针
java·linux·c语言·开发语言·数据结构·算法·vim
L_09071 小时前
【C】编译与链接
c语言·开发语言
ZWZhangYu1 小时前
【Arthas命令实践】heapdump实现原理
java·开发语言·python
扶梦4111 小时前
腾讯云AI代码助手编程挑战赛-解忧助手
java·linux·数据库