Uploaded image for project: 'Causeway'
  1. Causeway
  2. CAUSEWAY-1396

Some elements on an entity page can be rendered against stale data.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.12.1
    • 1.12.2
    • Core
    • None

    Description

      In the contactapp (github.com/incodehq/contactapp), if edit a ContactGroup, then the Country title/icon are shown as null. This seems to be because they are being rendered against a stale version of the ContactGroup, ie after the JDO transaction has completed.

      Two different fixes.

      The first would seem to be to move the stuff that builds the EntityPage component hierarchy out of the EntityPage constructor and into the EntityPage's onBeforeRender() method.

      This works, but does solve the underlying issue. Talking with martin-g, he says this ought not to be necessary and pointed to a possible issue with the EntityModel (impl of LoadableDetachableModel).

      Further investigation shows that this is indeed where the issue is. EntityModel holds a lazily-populated cache of ScalarModels, keyed by property(Id). This is not cleared down on detach, meaning that a subsequent rendering of the property containing the reference to the country is using a stale ObjectAdapter (never detached) that refers to a pojo that was reset at the end of the preceding transaction.

      Attachments

        Activity

          People

            danhaywood Daniel Keir Haywood
            danhaywood Daniel Keir Haywood
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: