Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Mysql and SQLContainer help.
I am trying out the demo address application and I am having a problem with the save button when saving items back in the database to
change some of the data like the persons name. The database is MYSQL and I am using the mysql-connnector-java-5.1.18.jar and vaadin-sqlcontainer-1.1.0.jar
The program saves all new items in the database, but you can't edit any of the items. I get the following error message: The id field in the database is a Int.
com.vaadin.event.ListenerMethod$MethodException
Cause: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:532)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219)
at com.vaadin.ui.Button.fireClick(Button.java:550)
at com.vaadin.ui.Button.changeVariables(Button.java:217)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVariables(AbstractCommunicationManager.java:1445)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1393)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1312)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:763)
at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
at com.example.testdemoapp.DemoFreeformQueryDelegate.storeRow(DemoFreeformQueryDelegate.java:106)
at com.vaadin.addon.sqlcontainer.query.FreeformQuery.storeRow(FreeformQuery.java:280)
at com.vaadin.addon.sqlcontainer.SQLContainer.commit(SQLContainer.java:855)
at com.example.testdemoapp.TestdemoappApplication$2.buttonClick(TestdemoappApplication.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:512)
... 23 more
the database table which it is trying to save is
delimiter $$
CREATE TABLE `people` (
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`FIRSTNAME` varchar(32) DEFAULT NULL,
`LASTNAME` varchar(32) DEFAULT NULL,
`COMPANY` varchar(32) DEFAULT NULL,
`MOBILE` varchar(20) DEFAULT NULL,
`WORKPHONE` varchar(20) DEFAULT NULL,
`HOMEPHONE` varchar(20) DEFAULT NULL,
`WORKEMAIL` varchar(128) DEFAULT NULL,
`HOMEEMAIL` varchar(128) DEFAULT NULL,
`STREET` varchar(32) DEFAULT NULL,
`ZIP` varchar(16) DEFAULT NULL,
`CITY` varchar(32) DEFAULT NULL,
`STATE` varchar(2) DEFAULT NULL,
`COUNTRY` varchar(32) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1$$
The two java files are from the demo. DemoFreeFormQueryDelegate.java and TestdemoApplication.java