Results 1 to 10 of 10

Thread: rename an entity

  1. #1
    Join Date
    Mar 2010
    Posts
    5

    Default rename an entity

    What is the easiest way to rename an entity class after it is created in roo?
    I tried using eclipse refactor, but it left quite a few things for me to change manually.
    Thanks

  2. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    Refactor > Rename should be OK. The only thing it won't rename is the associated tests and data on demand classes. Roo will pick up the rename and make new ITDs, removing the old ITDs for the old name.
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

  3. #3
    Join Date
    Nov 2010
    Posts
    5

    Default

    related question: In STS, I've used DBRE to create some entities and one of them, for example, is named Customers (based on the existing table "customers"). When I use the IDE to rename that class Customer, Roo regenerates new .aj files, but leaves out it's DbManaged file, which seems odd. Then, if I stop and restart the Roo shell, it recreates the old Customers structures and completely undoes my change... so I can't seem to control/rename these entities that are based on database reverse engineering. thanks for any help.

  4. #4
    Join Date
    Dec 2005
    Posts
    930

    Default

    Please raise a Jira ticket for this. I can only explain the latter part at the moment, in that, when Roo starts up, it looks at the .roo-dbre file and if the entity does not exist that matches a table name, it will get recreated. I believe now that the class name will need to be added (and maintained) in the <table> element so that new entities will not get created based on the table name if a previous entity has been renamed.
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  5. #5
    Join Date
    Dec 2005
    Posts
    930

    Default

    Issue fixed now
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  6. #6
    Join Date
    May 2006
    Posts
    15

    Question Fixed where?

    This is fixed in what release? I'm on 1.1.0.RELEASE [rev 793f2b0] and I'm still seeing this behavior.

    -Matt

  7. #7
    Join Date
    Dec 2005
    Posts
    930

    Default

    It is is fixed for the 1.1.1 release. Please download the code friom Git and try.
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  8. #8
    Join Date
    May 2006
    Posts
    15

    Thumbs up Excellent!

    Alan-

    Worked like a charm. Thanks!

    -Matt

  9. #9

    Default

    I have verified this as well. However, I would like to propose that the solution is not ideal. My testing shows that the renamed class is now ignored by DBRE. It is an improvement that DBRE no longer recreates the original class. What I would prefer if for DBRE to treat the new name as an alias. Specifically, I'd like it to still support round trip reverse engineering for the class. E.G. If I add a column to the "customers" table, I'd expect to see it appear in the "Customer" class. Is this asking too much?

    Bob

  10. #10
    Join Date
    Dec 2005
    Posts
    930

    Default

    Please raise an improvement ticket for this.
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

Posting Permissions

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