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.

相关推荐
我登哥MVP几秒前
【SpringMVC笔记】 - 4 - 三个域对象
java·spring boot·spring·servlet·tomcat·maven·intellij-idea
Seven972 分钟前
【从0到1构建一个ClaudeAgent】协作-Agent团队
java
进击的荆棘2 分钟前
C++起始之路——AVL树的实现
开发语言·数据结构·c++·stl·avl
郝学胜-神的一滴3 分钟前
[系统设计] 新鲜事系统:写扩散与读扩散的实现与对比
java·设计模式·php·软件构建·需求分析·软件设计·系统设计
进击的荆棘5 分钟前
C++起始之路——红黑树的实现
开发语言·数据结构·c++·stl·红黑树
疯狂成瘾者1 小时前
LangChain4j ApacheTikaDocumentParser:多格式文档接入的统一入
java·langchain4j
庞轩px2 小时前
第三篇:泛型深度解析——类型擦除与通配符的奥秘
java·编译·泛型·类型擦除
W.A委员会9 小时前
JS原型链详解
开发语言·javascript·原型模式
止语Lab9 小时前
Go并发编程实战:Channel 还是 Mutex?一个场景驱动的选择框架
开发语言·后端·golang
她说彩礼65万9 小时前
C# 实现简单的日志打印
开发语言·javascript·c#