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.

相关推荐
Tao____4 分钟前
JAVA开源物联网平台
java·物联网·mqtt·开源·ruoyi
Lhuu(重开版14 分钟前
JS:正则表达式和作用域
开发语言·javascript·正则表达式
yqd66618 分钟前
SpringSecurity的使用
java·spring
仙俊红31 分钟前
Java Map 家族核心解析
java·开发语言
浅念-34 分钟前
C语言小知识——指针(3)
c语言·开发语言·c++·经验分享·笔记·学习·算法
一嘴一个橘子1 小时前
springMvc 接收参数、cookie、header
java
code_li2 小时前
聊聊支付宝架构
java·开发语言·架构
少控科技2 小时前
QT高阶日记01
开发语言·qt
CC.GG2 小时前
【Linux】进程概念(五)(虚拟地址空间----建立宏观认知)
java·linux·运维
无限进步_2 小时前
【C++】大数相加算法详解:从字符串加法到内存布局的思考
开发语言·c++·windows·git·算法·github·visual studio