Java Spring Roo: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 44: | Line 44: | ||
=== Reverse engineering of the database === | === Reverse engineering of the database === | ||
Create Java Entity and AspectJ source | |||
<pre>database reverse engineer --schema DataBaseShema --package com.objclt.roo.sample</pre> | <pre>database reverse engineer --schema DataBaseShema --package com.objclt.roo.sample</pre> | ||
Revision as of 20:21, 1 December 2014
Installation
First Application
Create application from Database
- Assuming Roo is installed
- Validate with the roo addon manager if Mysql is already install org.springframework.roo.wrapping.mysql
- You may have to copy mysq.coonector.jar directly into the folder bundle in the roo installation directory
Install Mysql Driver
addon search mysql
addon install id 01
- If it goes wrong
osgi obr url add --url http://spring-roo-repository.springsource.org/repository.xml osgi obr deploy --bundleSymbolicName org.springframework.roo.wrapping.mysql-jdbc
- If it goes very wrong
Copy mysql-connect.jar into bundle directory of the root installation repository
Create project
project --topLevelPackage com.objclt.roo.sample
Create Database Connection
- Create persistence.xml and database.properties
persistence setup --provider HIBERNATE --database MYSQL --databaseName databaseName --hostName hostname --userName username --password password
Validate database.properties
jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.url=jdbc\:mysql\://localhost\:3306/Database_Name jdbc.usernameDatabase_User jdbc.password=User_Password
Validate persistence.xml
- Si operation is not mandatory as is will be replaced when generating entities from database
- Replace create by validate inside persistence.xml to disable the auto database creation
"Before" property name="hibernate.hbm2ddl.auto" value="create" "After" property name="hibernate.hbm2ddl.auto" value="validate"
Test Database Connection
database introspect --schema DatabaseSchema
Reverse engineering of the database
Create Java Entity and AspectJ source
database reverse engineer --schema DataBaseShema --package com.objclt.roo.sample
Configure Web presentation Layer
web mvc setup
Generate Controller
web mvc all --package ~.web