Java Spring Roo: Difference between revisions

From Objectif Client Inc
Jump to navigation Jump to search
Line 24: Line 24:
# Test Database Connection
# Test Database Connection
<pre>database introspect --schema DatabaseSchema</pre>
<pre>database introspect --schema DatabaseSchema</pre>
# Reverse engineering of the database
<pre>database reverse engineer --schema DataBaseShema --package com.objclt.roo.sample</pre>
=== If something goes wrong with the driver===
<pre>-
osgi obr url add --url http://spring-roo-repository.springsource.org/repository.xml
osgi obr deploy --bundleSymbolicName org.springframework.roo.wrapping.mysql-jdbc </pre>

Revision as of 17:52, 1 December 2014

Create application from Database

  1. Assuming Roo is installed
  2. Validate with the roo addon manager if Mysql is already install org.springframework.roo.wrapping.mysql
  3. Youmay have to copy mysq.coonector.jar directly into the folder bundle in the roo installation directory
  4. Create project
project --topLevelPackage com.objclt.roo.sample
  1. Create Database Connection
persistence setup --provider HIBERNATE --database MYSQL --databaseName databaseName --hostName hostname --userName username --password password
  1. Update database.properties
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc\:mysql\://localhost\:3306/Database_Name
jdbc.usernameDatabase_User
jdbc.password=User_Password
  1. 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"
  1. Install Mysql Driver
addon search mysql
 addon install id 01
  1. Test Database Connection
database introspect --schema DatabaseSchema
  1. Reverse engineering of the database
database reverse engineer --schema DataBaseShema --package com.objclt.roo.sample


If something goes wrong with the driver

-
osgi obr url add --url http://spring-roo-repository.springsource.org/repository.xml
osgi obr deploy --bundleSymbolicName org.springframework.roo.wrapping.mysql-jdbc