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.

相关推荐
金銀銅鐵6 分钟前
Byte Buddy 生成的类的结构如何?(第二篇)
java·后端
StackNoOverflow7 分钟前
Spring MVC零散知识点记录
java·spring·mvc
几许7 分钟前
高并发有序顺序号生成中间件 - 架构设计文档
java·后端
几许7 分钟前
高并发强一致性顺序号生成系统 -- SequenceGenerator
java·github
闻哥8 分钟前
深入理解 MySQL InnoDB Buffer Pool 的 LRU 冷热数据机制
android·java·jvm·spring boot·mysql·adb·面试
xiangpanf9 分钟前
PHP vs C语言:30字解析两大编程语言差异
c语言·开发语言·php
wdfk_prog10 分钟前
MAX14830 可移植 C 驱动实现分析:一个适合多串口扩展场景的开源基础版本
c语言·开发语言·开源
koping_wu12 分钟前
Java面试汇总:java基础、多线程、spring、jvm、分布式
java·spring·面试
摇滚侠14 分钟前
IDEA 开发,Mybatis 中,@Insert 注解如何提示出列名
java·intellij-idea·mybatis