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

Generated code causes compile errors

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.5.RELEASE
    • Fix Version/s: 1.3.0.RELEASE
    • Component/s: JSF
    • Labels:
      None

      Description

      In case the JPA entity has a field which is of type java.util.List instead of java.util.Set, the managed bean aspect is generated incorrectly and causes compile errors.

      Steps to reproduce:

      project --topLevelPackage org.example.spring
      jpa setup --provider HIBERNATE --database MYSQL
      entity jpa --class org.example.spring.Foo
      entity jpa --class org.example.spring.Bar
      focus --class ~.Foo
      field list --fieldName bars --type ~.Bar
      web jsf setup --implementation ORACLE_MOJARRA --library PRIMEFACES
      web jsf all --package ~.bean
      

      Results in an aspect called FooBean_Roo_ManagedBean which includes the following method:

      public void FooBean.setSelectedBars(List<Bar> selectedBars) {
              if (selectedBars != null) {
                  foo.setBars(new HashSet<Bar>(selectedBars));
              }
              this.selectedBars = selectedBars;
          }
      

      which should be

      public void FooBean.setSelectedBars(List<Bar> selectedBars) {
              if (selectedBars != null) {
                  foo.setBars(new ArrayList<Bar>(selectedBars));
              }
              this.selectedBars = selectedBars;
          }
      

      The pull request for this issue is created, the url is attached.

        Attachments

          Activity

            People

            • Assignee:
              eruiz Enrique Ruiz (DiSiD)
              Reporter:
              saschafroehlich Sascha Fröhlich
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: