Best way to connect Vaadin to MySQL

Hi,

I’m a beginner using Vaadin 7 at the moment (although wondering if I should just start using 8 now?)

I want to connect the data form elements to a MySQL DB in an easy, well strcutured way. I gathered this was best done using JPA but now the container is deprecated I’m a bit lost. I could do with having an example application doing the connection to MySQL as well. Can anybody help please :slight_smile:

Hello,

It’s quite easy to mix all those concepts, even more when Vaadin8 is out and comes changing some rules (for the greater good !)
While jpacontainer may not be your best friend, JPA is still a good way. You can glue it to database the way you want, from manual connection to some spring-magic.

For a start, you can take a look at those docs and samples :
https://github.com/mstahv/spring-data-vaadin-crud
https://vaadin.com/docs/-/part/framework/datamodel/datamodel-forms.html

Regards

Hi Sebastian,

Thanks for pointing me to those, although I try and build the spring-data-vaadin-crud example and get the following error:

Error parsing jar file: file:/Users/markbutler/Downloads/spring-data-vaadin-crud-master/target/classes

Widgetsets found from classpath:

org.vaadin.teemu.switchui.SwitchComponentWidgetset in file:/Users/markbutler/.m2/repository/org/vaadin/teemu/switch/2.0.2/switch-2.0.2.jar

Search took 29ms

[INFO]
1 addons found.

[INFO]

[INFO]
BUILD FAILURE

[INFO]

[INFO]
Total time: 2.250 s

[INFO]
Finished at: 2017-03-18T06:09:19+00:00

[INFO]
Final Memory: 24M/227M

[INFO]

[ERROR]
Failed to execute goal com.vaadin:vaadin-maven-plugin:7.7.3:update-widgetset (default) on project spring-data-vaadin-crud: Execution default of goal com.vaadin:vaadin-maven-plugin:7.7.3:update-widgetset failed: A required class was missing while executing com.vaadin:vaadin-maven-plugin:7.7.3:update-widgetset: org/apache/http/params/HttpParams

[ERROR]