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.

相关推荐
小碗羊肉1 分钟前
Maven高级
java·开发语言·maven
不知名的老吴2 分钟前
C++ 中函数对象的形式概述
开发语言·c++
星秀日8 分钟前
Spring Boot + Sa-Token 实时聊天系统:用户注册流程源码深度剖析
java·人工智能·spring·状态模式
Shan120512 分钟前
C++中函数对象之重载 operator()
开发语言·c++·算法
HelloWorld1024!21 分钟前
c++核心之万字详解 * 和 & 所有用法(指针、引用、取地址、解引用、常量修饰)
开发语言
Legendary_00827 分钟前
解析 PD Sink 与 LDR6500U:Type-C 取电的核心密码
c语言·开发语言
冴羽yayujs33 分钟前
JavaScript 9 个先有库再有 API 的故事
开发语言·javascript·ecmascript
回忆2012初秋36 分钟前
.NET 8.0 实战:基于 MQTTnet 封装高可用的 MQTT 发布/订阅工具类
开发语言·mqtt·.net
油丶酸萝卜别吃1 小时前
JavaScript 深度合并函数 deepMerge 实现指南(附完整测试用例)
开发语言·javascript·测试用例
念恒123061 小时前
Python(for循环进阶)
开发语言·python