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.

相关推荐
桥田智能4 分钟前
桥田智能 QT-650S:面向白车身焊装的 800kg 重载快换解决方案
开发语言·qt·系统架构
开发小能手-roy42 分钟前
StringBuilder vs StringBuffer:2024年还需要线程安全字符串吗?
开发语言·python·安全
开发小能手-roy44 分钟前
Java集合框架选型指南:从ArrayList到ConcurrentSkipListMap
java·开发语言
凡人叶枫1 小时前
Effective C++ 条款41:了解隐式接口和编译期多态
java·开发语言·c++·effective c++
凡人叶枫1 小时前
Effective C++ 条款42:了解 typename 的双重意义
java·linux·服务器·c++
2601_954706491 小时前
云手机技术详解+Python实战调用|2026高稳云手机平台推荐
开发语言·python·智能手机
chushiyunen1 小时前
java中的路径处理、左右斜杠
java·开发语言·python
yyxx4121232 小时前
上海企业如何选择专业的钉钉服务商
java·大数据·人工智能·钉钉
一杯奶茶¥2 小时前
水果销售网站 CRM客户信息管理系统 超市管理系 酒店管理系统 健身房管理系统 在线音乐网站 校园招聘系统
java·vue.js·spring boot·mysql·spring·java项目
重生之后端学习2 小时前
Java入门
java·开发语言·职场和发展