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.

相关推荐
CoderYanger几秒前
动态规划算法-两个数组的dp(含字符串数组):41.最长公共子序列(模板)
java·算法·leetcode·动态规划·1024程序员节
克喵的水银蛇2 分钟前
Flutter 通用下拉选择器:DropdownSelector 一键实现自定义下拉交互
开发语言·javascript·ecmascript
凌波粒4 分钟前
Springboot基础教程(8)--Shiro
java·spring boot·后端
dzl843947 分钟前
springboot脚手架备忘
java
feathered-feathered10 分钟前
网络套接字——Socket网络编程(TCP编程详解)
java·网络·后端·网络协议·tcp/ip
路边草随风2 小时前
java实现发布spark yarn作业
java·spark·yarn
为爱停留2 小时前
Spring AI实现MCP(Model Context Protocol)详解与实践
java·人工智能·spring
汝生淮南吾在北5 小时前
SpringBoot+Vue饭店点餐管理系统
java·vue.js·spring boot·毕业设计·毕设
fish_xk5 小时前
c++中的引用和数组
开发语言·c++
酒尘&8 小时前
JS数组不止Array!索引集合类全面解析
开发语言·前端·javascript·学习·js