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 分钟前
Java开发环境搭建
java·开发语言·后端
阿洛学长7 分钟前
VMware安装虚拟机教程(超详细)
java·linux·开发语言
rit84324997 分钟前
链路预测(Link Prediction)MATLAB 实现
开发语言·matlab
jiayong238 分钟前
01 检查 Python 版本与环境
开发语言·python
coder Ethan11 分钟前
Spring AI 入门:(3)快速搭建一个简单的问答助手
java·人工智能·spring
屋外雨大,惊蛰出没13 分钟前
starter的创建与引用
java·stater
小同志0015 分钟前
Spring Boot ⽇志概述(简单了解)
java·java-ee·日志
小马爱打代码19 分钟前
SpringBoot + 延迟消息 + 时间轮:订单超时、优惠券过期等场景的高效实现方案
java·spring boot·后端
就叫_这个吧23 分钟前
Java普通类、抽象类、接口的应用和区别
java·开发语言
梅孔立26 分钟前
解决Nginx缓存不写入响应体问题:浏览器强制不缓存配置教程
java·开发语言·nginx·spring