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.