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

Label error appears when exists more than one field with the same class in the same entity

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 1.2.4.RELEASE
    • Fix Version/s: 1.3.0.RELEASE
    • Component/s: WEB MVC
    • Labels:

      Description

      The problem appears when exists more than one field with the same class in the same entity:

      Itinerary.java
      ...
      
          @NotNull
          @ManyToOne
          private KP initialKP;
      
          @NotNull
          @ManyToOne
          private KP finalKP;
      
      ...
      

      Then, RoadController_Roo_Controller.java has method createForm:

      RoadController_Roo_Controller.java
      ...
      
       if (KP.countKPS() == 0) {
                  dependencies.add(new String[] { "kp", "kps" });
              }
              if (KP.countKPS() == 0) {
                  dependencies.add(new String[] { "kp", "kps" });
              }
      
      ...
      

      When there's not records in the entity, createForm method add a dependency message using the "kp" to build label... however "kp" label doesn't exists in application.js and appears the following error:

      No message found under code 'label_org_roo_road_domain_itinerary_kp' for locale 'es'.
      

      ------------------------------------------

      To solve this, is necessary to edit WebScaffoldMetadata.java:338 and use fieldName instead of EntityName to generate createForm method...

      Then, the generated source will be:

      RoadController_Roo_Controller.java
      ...
      
              if (KP.countKPS() == 0) {
                  dependencies.add(new String[] { "initialKp", "kps" });
              }
              if (KP.countKPS() == 0) {
                  dependencies.add(new String[] { "finalKp", "kps" });
              }
      
      ...
      

        Attachments

          Activity

            People

            • Assignee:
              jcgarcia Juan Carlos García del Canto
              Reporter:
              jcgarcia Juan Carlos García del Canto
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: