WELCOME Abdennour : Software engineer

Nov 2, 2012

Creating Spring Roo project from existing DataBase(Reverse Engineering)


                                     


Method 1 :

1. Open roo shell
 $roo

2.Create your project and set the main configuration then Enter this Command :
roo>persistence setup --provider HIBERNATE --database MYSQL --databaseName consultationmedicale --userName root --password 0000

NOTE: Don't forget to replace "root" by  your MySql UserName and "0000" by your MySql password




3.addon install bundle :
roo> bundle --bundleSymbolicName org.springframework.roo.wrapping.mysql-connector-java

4.Add MySql Connector Jar too Context :
roo> osgi start --url file:///C:/path/to/mysql-connector-java-5.1.18-bin.jar

5.Generate XML Description of Database 
roo> database introspect --schema consultationmedical
Note : Replace "consultationmedical" by your database Name .


Result
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.--><database name="deprecated">
    <option key="moduleName" value=""/>
    <option key="activeRecord" value="false"/>
    <option key="includeNonPortableAttributes" value="true"/>
    <option key="testAutomatically" value="false"/>
    <table name="consultation">
        <column name="idc" primaryKey="true" required="true" scale="0" size="10" type="4,INT"/>
        <column name="datec" primaryKey="false" required="false" scale="0" size="45" type="12,VARCHAR"/>
      .
      ..
   .. ... 

    </table>
</database>

1 comment: