Announcement Announcement Module
Collapse
No announcement yet.
rename an entity Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


    • #3
      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.

      Comment


      • #4
        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.

        Comment


        • #5
          Issue fixed now

          Comment


          • #6
            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

            Comment


            • #7
              It is is fixed for the 1.1.1 release. Please download the code friom Git and try.

              Comment


              • #8
                Excellent!

                Alan-

                Worked like a charm. Thanks!

                -Matt

                Comment


                • #9
                  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

                  Comment


                  • #10
                    Please raise an improvement ticket for this.

                    Comment

                    Working...
                    X