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

Show view of read only entity throws an exception

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0.0.RELEASE
    • Fix Version/s: None
    • Component/s: WEB MVC
    • Labels:
      None

      Description

      Hello,

      Since this is my first roo project I'm not that experienced. I believe I discovered an unwanted feature.

      I have created one entity that is read only since the data in the table is supposed to be created by a backend process. The web interface will be only used for viewing the data.

      I used the following roo command for this:

      entity jpa --class ~.SapLogging --table PPSIFACE --readOnly --versionField ver

      I followed the complete tutorial and I got the web application running.

      The web page properly lists the entries in this table. When I click on the tools to view the contents I get HTTP 500 error. In the output on the console I see the following error:

       

      java.lang.IllegalArgumentException: Invalid method name: editForm

       

      I figured out that this is caused by the "Edit" button placed in the show.html.

       

      After struggling around I changed the freemarker's template to condition the placing of the Edit button:
      <#if entity.readOnly == false>

      <div class="clearfix">
      <div class="pull-right">
      <a id="${entityName}_edit" href="edit.html" class="btn btn-primary"
      data-th-title="${r"# {"}label_goEdit}"
      data-th-href="${"${"}@linkBuilder.of('${mvcItemControllerName}').to('editForm').with('${modelAttributeName}', ${modelAttributeName}.${identifierField})}"
      data-th-text="${r"#{"}

      label_edit}">Edit</a>
      </div>
      </div>
      </#if>

       

      I hope this makes sense and can be included standard in the release. 

       

      Regards,

      Peter

        Attachments

          Activity

            People

            Assignee:
            eruiz Enrique Ruiz (DiSiD)
            Reporter:
            peter-gurov peter-gurov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: