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.

相关推荐
Grey Zeng8 小时前
Java SE 25新增特性
java·jdk·jdk新特性·jdk25
雨白10 小时前
Java 线程通信基础:interrupt、wait 和 notifyAll 详解
android·java
架构师沉默14 小时前
设计多租户 SaaS 系统,如何做到数据隔离 & 资源配额?
java·后端·架构
Java中文社群15 小时前
重要:Java25正式发布(长期支持版)!
java·后端·面试
每天进步一点_JL16 小时前
JVM 类加载:双亲委派机制
java·后端
用户2986985301417 小时前
Java HTML 转 Word 完整指南
java·后端
渣哥17 小时前
原来公平锁和非公平锁差别这么大
java
渣哥17 小时前
99% 的人没搞懂:Semaphore 到底是干啥的?
java
J2K17 小时前
JDK都25了,你还没用过ZGC?那真得补补课了
java·jvm·后端
kfyty72517 小时前
不依赖第三方,不销毁重建,loveqq 框架如何原生实现动态线程池?
java·架构