Connect to MYSQL in Spring Roo

First you need to install MYSQL, then setup the database e.g “jarvis”

then run the following command

jpa setup –provider HIBERNATE –database mysql

then you need to edit the file at src/main/resources/meta-inf/spring/ as follows

#Updated at Sat Sep 15 19:31:58 EST 2012
#Sat Sep 15 19:31:58 EST 2012

properties list –name –path String_config_root

this command shows you the configuration.

After you have done this, you can add in the entities

and then do the mvc setup:

web mvc setup

web mvc all –package ~.web

Now if you run the project, it will give the error that the driver is not found

you have to run “perform eclipse” command,

this is a magic command that it will look at the dependencies from the .pom file and download all the libraries(jars) that are required,

it will store the libraries at the local repository, in my case it’s at “C:\Users\Jackie\.m2\repository\”

Remember don’t stop the perform eclipse half way like I did, or you will have to delete the files and do the command again, it took me ages to figure it out why the files are there but it just doesn’t work.

in the persistence.xml, there is a <property name=”” value=”create”/>, this decides what will happen to the table each time you run it.


2 thoughts on “Connect to MYSQL in Spring Roo

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s