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.

相关推荐
0xDevNull5 分钟前
Spring Boot 3.x 整合 Nacos 全栈实战教程
java·spring boot·nacos
落木萧萧8256 分钟前
MyBatisGX 示例工程:CRUD + 关联查询完整演示
java·后端
两年半的个人练习生^_^11 分钟前
每日一学:设计模式之原型模式
java·开发语言·设计模式·原型模式
biubiubiu070611 分钟前
Maven 父子工程 SpringBoot 多模块
java·spring boot·maven
elseif12312 分钟前
初学者必背【考点清单(大全)】【上篇】
开发语言·c++·笔记·学习·循环结构·分支结构·考纲
并不喜欢吃鱼12 分钟前
从零开始C++----二.(下篇)模版进阶与编译全过程的复习
开发语言·c++
234710212715 分钟前
4.17 学习笔记
开发语言·软件测试·笔记·python·学习
不知名的老吴30 分钟前
View的三大特性之一:迟绑定
开发语言·c++·算法
tumeng071131 分钟前
Spring详解
java·后端·spring
深邃-38 分钟前
【Web安全】-基础环境安装:虚拟机安装,JDK环境安装(1)
java·开发语言·计算机网络·安全·web安全·网络安全·安全架构