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.

相关推荐
卷Java10 分钟前
Python字典:键值对、get()方法、defaultdict,附通讯录实战
开发语言·数据库·python
liuyao_xianhui10 分钟前
优选算法_翻转链表_头插法_C++
开发语言·数据结构·c++·算法·leetcode·链表·动态规划
happy_baymax13 分钟前
三电平矢量表达式MATLAB实现
开发语言·matlab
xyq202414 分钟前
jEasyUI 创建 XP 风格左侧面板
开发语言
赫瑞15 分钟前
Java中的最长公共子序列——LCS
java·开发语言
于先生吖18 分钟前
零基础开发国际版同城出行平台 JAVA 顺风车预约系统实战教学
java·开发语言
代码雕刻家19 分钟前
2.22.StringBuffer类的常见用法、
java·开发语言
yhole20 分钟前
Java进阶(ElasticSearch的安装与使用)
java·elasticsearch·jenkins
明月(Alioo)34 分钟前
Python 并发编程详解 - Java 开发者视角
java·开发语言·python
JAVA+C语言1 小时前
C++ STL map 系列全方位解析
开发语言·c++