Results 1 to 10 of 10

Thread: Strange error with database reverse engineer and mysql

  1. #1
    Join Date
    Mar 2012
    Posts
    6

    Default Strange error with database reverse engineer and mysql

    I was able to use the dbre with roo 1.1.5 and 1.2.0.M1 however when I try 1.2.0.RELEASE, 1.2.1.RELEASE it always fails with the the following error message (I removed the package name):
    Compilation unit package '*' unexpected for type 'java.lang'

    This is the command that I used:
    database reverse engineer --schema no-schema-required --activeRecord false --package ~.database

    The annoying part is that it works just fine if I drop back to 1.2.0.M1, it just doesn't work with any newer release. Although to be accurate, even though it runs through the dbre process just fine on 1.2.0.M1 I have to go in and manually modify the dbre.xml to fix an issue with TEXT fields. Could this be the issue creating the mysterious error message?

  2. #2
    Join Date
    Dec 2005
    Posts
    929

    Default

    You can log a Jira issue for us to look at. Please make sure you attach your dbre.xml file and if possible the MySQL schema DDL.
    Thanks
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  3. #3
    Join Date
    Oct 2011
    Posts
    13

    Default let me continue

    Hi team, sorry for my English.
    I was working on sts2.7.2 early, today I downloaded 2.9.0 release and have a lot of strange problems.
    I can't create any project as before.
    database reverse doesn't work with me at all. I'm having same message "Compilation unit package unexpected for type 'java.lang'"

    Let me attach project backup and database structure here.carroza.sql.ziptest4_2012-03-13_05:55:43.zip

    Also, if I use project structure (src packages) as 2 level (uz.test), spring roo dowsn't work at all inside STS, but work from console
    But if I will use 3 levels (uz.test.testit) - it works both console and STS.

    Please take a look, if I have to create JIRA issue, I will do so.

  4. #4
    Join Date
    Oct 2011
    Posts
    13

    Default

    Seems I have too much problems
    I installed ubuntu 11.10 64bit, openjdk-6 (sun-version is also installed)
    And for STS 2.9.0 I have an error "Project facet grails.app has not been defined. It is used in plugin com.springsource.sts.server.tc.core", which prevents project creation.

    Can anybody explain, how I can upgrade STS to 2.9.1M2 version?

  5. #5
    Join Date
    Oct 2011
    Posts
    13

    Default

    and one more thing,
    on STS 2.7.2, roo console - database reverse doesn't do anything, but if I run roo from console - it successfully created all files!

  6. #6
    Join Date
    Oct 2011
    Posts
    13

    Default

    I don't want to create a new thread, so let me continue posting here

    Here is another thing I found, it related with ROO 1.2.1 version:
    ROO generates a database table class and some aspect files. By default it generates for ID column code in *_Roo_Jpa_Entity.aj like
    Code:
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private Long Favorite.id;
    If I move this code to the class file (just to change GenerationType.AUTO to GenerationType.IDENTITY), Roo:
    1. removes this annotations only from original *_Roo_Jpa_Entity.aj
    2. creates *_Roo_JavaBean.aj and writes there getId() and setId() methods

    But, both methods still exists in *_Roo_Jpa_Entity.aj! So we have an error. To fix it I have to move both methods to the class, where an annotation has been moved.

    And if I later edit entity class file and remove from there getId() and setId() methods, Roo adds boths methods to *_Roo_Jpa_Entity.aj and also creates *_Roo_JavaBean.aj. SO no way just to move annotation, I have to move methods too.

    In Roo 1.1.5 version of STS 2.7.2 this problem didn't exists. Think it is an issue too..
    Last edited by shvaber; Mar 14th, 2012 at 02:44 AM.

  7. #7
    Join Date
    Mar 2012
    Posts
    6

    Default

    I just throught I would post back that I found what was causing the error for me. The difficult part is that I can't directly fix it.

    Basically what was happening is that I had a table called Thread. This is a violation of the rule with java.lang and hence the error. However this is an existing database created before Roo existed. So in a way I feel disappointed that Roo doesn't give it an alternate name to ensure that it doesn't error like this.

    So currently the solution is to do this, if you run into this problem:
    1) build it with 1.2.0.M1 so that you get the latest database reverse engineering setup (ie the change in roo's entity name).
    2) Then rename the class that breaks the ability for Roo 1.2.1 to work with.
    3) Load it up in the Roo 1.2.1 and watch it go to work for you again.

    Annoying. Anyways enjoy.
    Last edited by JuddP; Mar 27th, 2012 at 05:20 PM.

  8. #8
    Join Date
    Dec 2005
    Posts
    929

    Default

    If you can't change the table name, you can modify the dbre.xml file to change the table. However, this can potentially affect future reverse engineer operations.
    Alan
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  9. #9
    Join Date
    Mar 2012
    Posts
    6

    Default

    Quote Originally Posted by Alan Stewart View Post
    If you can't change the table name, you can modify the dbre.xml file to change the table. However, this can potentially affect future reverse engineer operations.
    Alan
    I noticed that you could create a class and annotate it with the table name and it would do the reverse engineering without issue as well. Not entirely sure this is intended behavior, but thought I should point it out. It does at least allow me to reverse engineer as many times as I want after that without breaking.

  10. #10
    Join Date
    Dec 2005
    Posts
    929

    Default

    Correct - sorry, forgot to mention this feature. Mapping table names to entities can't be changed on the database reverse engineer command, but user changes afterwards are respected and maintained.
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

Tags for this Thread

Posting Permissions

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