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.

相关推荐
SEO-狼术2 分钟前
RAD Studio 13.1 Florence adds
java
ywf121513 分钟前
Spring Boot接收参数的19种方式
java·spring boot·后端
smchaopiao38 分钟前
Python中字典与列表合并的问题与解决方法
开发语言·python
敲代码的瓦龙1 小时前
Java?面向对象三大特性!!!
java·开发语言
2501_921649491 小时前
期货 Tick 级数据与基金净值历史数据 API 接口详解
开发语言·后端·python·websocket·金融·区块链
架构师沉默1 小时前
AI 写的代码,你敢上线吗?
java·后端·架构
野犬寒鸦1 小时前
Redis复习记录day1
服务器·开发语言·数据库·redis·缓存
小菜鸡桃蛋狗1 小时前
C++——类和对象(下)
开发语言·c++
骑龙赶鸭1 小时前
java开发项目中遇到的难点,面试!
java·开发语言·面试