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.

相关推荐
better_liang4 分钟前
每日Java面试场景题知识点之-Redisson热门使用场景
java·redis·微服务·分布式锁·redisson·分布式系统
2301_792674867 分钟前
java学习 day26
java
!停8 分钟前
C++入门—初阶模板
开发语言·c++
so2F32hj28 分钟前
拆解 OpenHands(14)--- Microagents
java·开发语言
明灯伴古佛13 分钟前
面试:什么是可重入性?为什么 synchronized 是可重入锁?
java·jvm·面试
卓怡学长17 分钟前
m307自习室预订座位管理分析与实现
java·spring boot·spring
Jp7gnUWcI22 分钟前
C++ 内存避坑指南:如何用移动语义和智能指针解决“深拷贝”与“内存泄漏”
开发语言·c++
Arya_aa23 分钟前
生猪养殖溯源系统前期准备与SpringBoot框架
java·spring boot
Full Stack Developme38 分钟前
Java Simple Serial Connector 教程
java·stm32·单片机
xcs1940541 分钟前
Java 上位机防空警报系统开发
java·开发语言