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.

相关推荐
鱼鳞_10 分钟前
Java学习笔记_Day22
java·笔记·学习
今天又是充满希望的一天20 分钟前
C++分布式系统知识
开发语言·c++
zth41302130 分钟前
SegmentSplay‘s Super STL(v2.2)
开发语言·c++·算法
__土块__31 分钟前
一次电商秒杀系统架构评审:从本地锁到分布式锁的演进与取舍
java·redis·高并发·分布式锁·redisson·架构设计·秒杀系统
她说..35 分钟前
Java 注解核心面试题
java·spring boot·spring·spring cloud·自定义注解
用户83071968408235 分钟前
Spring Boot @Qualifier深度解密:从“按名查找”到“分组批量注入”,一文掌握它的全部“隐藏技能”。
java·spring boot
亦暖筑序43 分钟前
Message 四分天下:Spring AI 如何统一消息格式
java·人工智能
镜花水月linyi1 小时前
JDK 8 → 17 → 21 → 25:一次性讲清四代版本的关键跃迁
java·后端
沐知全栈开发1 小时前
《jEasyUI 格式化列》
开发语言
0xDevNull1 小时前
JDK 25 新特性概览与实战教程
java·开发语言·后端