Results 1 to 10 of 10

Thread: DB reverse engineer issue

  1. #1
    Join Date
    Apr 2011
    Posts
    12

    Default DB reverse engineer issue

    Hi there,

    the dbre.xml was updated and seems listed all the tables but nothing actually is created other than that.

    roo> database reverse engineer --package ~.domain --schema dbo
    Created SRC_MAIN_RESOURCES\dbre.xml
    org.springframework.roo.classpath.TypeLocationServ ice.findClassOrInterface(Lorg/springframework/roo/model/JavaTypeLorg/springframework/roo/classpath/details/ClassOrInterfaceTypeDetails;

  2. #2
    Join Date
    Dec 2005
    Posts
    929

    Default

    What Roo release are you using and can you attach a DDL for the database and/or the dbre.xml here?
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  3. #3
    Join Date
    Apr 2011
    Posts
    12

    Default

    Actually, I have tried both 1.1.2 and downloaded the latest SpringSource Tool Suite Version: 2.6.0.RELEASE (with 1.1.3 roo) the result are the same.

    Also I have tried to create a roo project with one entity
    • project --topLevelPackage com.test --projectName ReverDB --java 6
    • persistence setup --provider HIBERNATE --database MSSQL --userName appusr --password password
    • entity --class ~.domain.Product
    • field string --fieldName name --notNull
    • controller scaffold --class ~.web.ProductController --entity ~.domain.Product


    and then create another roo project to reverse eng the Product table, it is still the same.



    ====================== DBRE.xml ===============
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!--WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.-->
    <database name="dbo" package="com.test.domain">
    <option key="testAutomatically" value="false"/>
    <option key="includeNonPortableAttributes" value="false"/>
    <table name="product">
    <column name="id" primaryKey="true" required="false" scale="0" size="19" type="2,numeric() identity"/>
    <column name="name" primaryKey="false" required="false" scale="0" size="255" type="12,varchar"/>
    <column name="version" primaryKey="false" required="false" scale="0" size="10" type="4,int"/>
    <unique name="PK__product__214BF109">
    <unique-column name="id"/>
    </unique>
    </table>
    </database>

  4. #4
    Join Date
    Dec 2005
    Posts
    929

    Default

    Can you delete the dbre.xml file, load Roo and turn dev mode on, and re-run the reverse engineer command? I need to see the stack trace produced

    To enable dev mode:

    Code:
    roo> development mode --enabled true
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  5. #5
    Join Date
    Apr 2011
    Posts
    12

    Default

    Welcome to Spring Roo. For assistance press CTRL+SPACE or type "hint" then hit ENTER.
    roo> development mode --enabled true
    Development mode set to true
    roo> database reverse engineer --package ~.domain --schema dbo --includeTables "product"
    308f0e4 Created SRC_MAIN_RESOURCES\dbre.xml
    org.springframework.roo.classpath.TypeLocationServ ice.findClassOrInterface(Lorg/springframework/roo/model/JavaTypeLorg/springframework/roo/classpath/details/ClassOrInterfaceTypeDetails;
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!--WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.-->
    <database name="dbo" package="com.test.domain">
    <option key="testAutomatically" value="false"/>
    <option key="includeNonPortableAttributes" value="false"/>
    <table name="product">
    <column name="id" primaryKey="true" required="false" scale="0" size="19" type="2,numeric() identity"/>
    <column name="name" primaryKey="false" required="false" scale="0" size="255" type="12,varchar"/>
    <column name="version" primaryKey="false" required="false" scale="0" size="10" type="4,int"/>
    <unique name="PK__product__214BF109">
    <unique-column name="id"/>
    </unique>
    </table>
    </database>

  6. #6
    Join Date
    Dec 2005
    Posts
    929

    Default

    If your dbre xml file is in src/main/resources/dbre.xml then Roo 1.1.2 will not process this file (see https://jira.springsource.org/browse/ROO-2245).

    Since I don't have the schema to reverse engineer off, I am testing with making manual changes to the the dbre.xml file in src/main/resources with 1.1.3 and it all works OK.

    I can't explain your 1.1.2 scenario as if I reverse engineer a Postgres or MySQL db with 1.1.2, it works OK.

    I also tested your file in STS with 1.1.3 and once again it works fine.

    If you want to log a Jira ticket I can look at it further. You must attach a backup of the project and make sure the .roo-dbre (if generated with 1.1.2) is also attached, as the Roo backup command will exclude this file.
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  7. #7
    Join Date
    Apr 2011
    Posts
    12

    Default

    Hi there again,

    I think the problem is the STS's IDE roo issue, I have tried to use mysql as well, the result still the same but if i use the cmd roo instead of IDE roo then it works fine for the simple DBRS.

    thanks.

  8. #8
    Join Date
    Apr 2011
    Posts
    12

    Default

    somehow doesn't seem very consistence, it works ok once and then i start a new project and try it again then other error....

    roo> database reverse engineer --schema dbo --package ~.web
    3f78b47 Created SRC_MAIN_RESOURCES\dbre.xml
    Exception in thread "Spring Roo JLine Shell" java.lang.NoSuchMethodError: org.springframework.roo.support.util.XmlUtils.read Xml(Ljava/io/InputStreamLorg/
    w3c/dom/Document;
    at org.springframework.roo.addon.dbre.DbreOperationsI mpl.updatePom(DbreOperationsImpl.java:98)
    at org.springframework.roo.addon.dbre.DbreOperationsI mpl.reverseEngineerDatabase(DbreOperationsImpl.jav a:64)
    at org.springframework.roo.addon.dbre.DbreCommands.se rializeDatabaseMetadata(DbreCommands.java:51)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.roo.support.util.ReflectionUti ls.invokeMethod(ReflectionUtils.java:191)
    at org.springframework.roo.process.manager.ProcessMan agerHostedExecutionStrategy$1.callback(ProcessMana gerHostedExecutionStrategy.java:49)
    at org.springframework.roo.process.manager.internal.D efaultProcessManager.doTransactionally(DefaultProc essManager.java:180)
    at org.springframework.roo.process.manager.internal.D efaultProcessManager.execute(DefaultProcessManager .java:143)
    at org.springframework.roo.process.manager.ProcessMan agerHostedExecutionStrategy.execute(ProcessManager HostedExecutionStrategy.java:47)
    at org.springframework.roo.shell.AbstractShell.execut eCommand(AbstractShell.java:182)
    at org.springframework.roo.shell.jline.JLineShell.pro mptLoop(JLineShell.java:373)
    at org.springframework.roo.shell.jline.JLineShell.run (JLineShell.java:134)
    at java.lang.Thread.run(Unknown Source)
    org.springframework.roo.classpath.TypeLocationServ ice.findClassOrInterface(Lorg/springframework/roo/
    model/JavaTypeLorg/springframework/roo/classpath/details/ClassOrInterfaceTypeDetails;
    java.lang.NoSuchMethodError: org.springframework.roo.classpath.TypeLocationServ ice.findClassOrInterf
    ace(Lorg/springframework/roo/model/JavaTypeLorg/springframework/roo/classpath/details/ClassOrInterfaceTypeDetails;
    at org.springframework.roo.addon.dbre.DbreDatabaseLis tenerImpl.reverseEngineer(DbreDatabaseListe
    nerImpl.java:148)
    at org.springframework.roo.addon.dbre.DbreDatabaseLis tenerImpl.deserializeDatabase(DbreDatabaseL
    istenerImpl.java:104)
    at org.springframework.roo.addon.dbre.DbreDatabaseLis tenerImpl.onFileEvent(DbreDatabaseListenerI
    mpl.java:83)
    at org.springframework.roo.file.monitor.polling.Polli ngFileMonitorService.publish(PollingFileMon
    itorService.java:330)
    at org.springframework.roo.file.monitor.polling.Polli ngFileMonitorService.scanAll(PollingFileMon
    itorService.java:304)
    at org.springframework.roo.process.manager.internal.D efaultProcessManager.doTransactionally(Defa
    ultProcessManager.java:178)
    at org.springframework.roo.process.manager.internal.D efaultProcessManager.backgroundPoll(Default
    ProcessManager.java:125)
    at org.springframework.roo.process.manager.internal.D efaultProcessManager.timerBasedPoll(Default
    ProcessManager.java:240)
    at org.springframework.roo.process.manager.internal.D efaultProcessManager$2.run(DefaultProcessMa
    nager.java:68)
    at java.lang.Thread.run(Unknown Source)

  9. #9
    Join Date
    Dec 2005
    Posts
    929

    Default

    What release of Roo are you using either in stand-alone or inside STS? It looks like you have a mixture of OSGi Roo bundles from different releases, which would explain the NoSuchMethodError as XmlUtils.readXml was introduced in 1.1.4 code but it appears you using different versions of the dbre and classpath modules.

    Please start with a fresh installation of the latest STS so we're all on the same page.
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  10. #10
    Join Date
    Apr 2011
    Posts
    12

    Default

    Ok, i am using the fresh installation one now, that problem is gone.

    I have other question about how to handle the clob to string? or string to clob?? should be common?

    thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •