Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-3557

reverse engineering randomly renames fields by adding suffixes

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.4.RELEASE, 1.2.5.RELEASE
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:
      Windows, Linux

      Description

      Database :MySQL
      Schema created by MySQL Workbench

      Example:
      first reverse engineering :
      ==========================
      @RooJavaBean
      @RooDbManaged(automaticallyDelete = true)
      @RooJson
      @RooToString(excludeFields =

      { "contentClasses", "contentClassAttributes", "products", "companies", "hierarchyLangs", "company" })
      @RooJpaActiveRecord(versionField = "", table = "hierarchy"})
      public class Hierarchy {

      @ManyToMany(mappedBy = "hierarchies", fetch = FetchType.LAZY)
      private Set<ContentClass> contentClasses;

      @ManyToMany(mappedBy = "hierarchies", fetch = FetchType.LAZY)
      private Set<ContentClassAttribute> contentClassAttributes;

      @ManyToMany(mappedBy = "hierarchies", fetch = FetchType.LAZY)
      private Set<Product> products;
      }

      second reverse engineering:
      ========================
      @RooJavaBean
      @RooDbManaged(automaticallyDelete = true)
      @RooJson
      @RooToString(excludeFields = { "contentClasses", "contentClassAttributes", "products", "companies", "hierarchyLangs", "company" }

      )
      @RooJpaActiveRecord(versionField = "", table = "hierarchy"})
      public class Hierarchy {

      @ManyToMany(mappedBy = "hierarchies", fetch = FetchType.LAZY)
      private Set<ContentClass> contentClasses_2;

      @ManyToMany(mappedBy = "hierarchies", fetch = FetchType.LAZY)
      private Set<ContentClassAttribute> contentClassAttributes;

      @ManyToMany(mappedBy = "hierarchies", fetch = FetchType.LAZY)
      private Set<Product> products_1;
      }

      remark fields: products and products_1, contentClasses and contentClasses_2 in the same entity Hierarchy

      Until this point, there is no problem.

      The problem when creating Restful Controllers, and use of finders and entities as json in frontend.

      Every reverse, we must rename concerning fields in the frontend, although "logically" the renaming should not be held after the reverse.

      Why rename products to products_1 ? they are the same field in the database !!!

      I have modified Spring roo 1.2.4 locally and i have commented some lines as you can see in the attached file.
      I dont know if this a good idea, but it works for me and since these changes, it's going well and everything is okay.

        Attachments

          Activity

            People

            • Assignee:
              eruiz Enrique Ruiz (DiSiD)
              Reporter:
              naddame Djamel Hamas
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: