Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-21334

Don't implicitly reconnect a DocumentModel

    XMLWordPrintable

    Details

    • Type: Clean up
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9.1
    • Component/s: Core
    • Tags:
    • Upgrade notes:
      Hide

      In 9.1 and later, trying to get a property from a document fetched through unrestricted code (UnrestrictedSessionRunner or Framework#doPrivileged) outside the unrestricted context throws the following exception if the data model including the property hasn't been loaded before:

      "NuxeoException: The DocumentModel is not associated to an open CoreSession"

      Possible solutions are:

      • Fetch the property instead of the whole document inside the unrestricted code (queryAndFetch).
      • Call detach(true) on the document within the unrestricted code.
      • Prefetch the schema declaring the property.
      Show
      In 9.1 and later, trying to get a property from a document fetched through unrestricted code (UnrestrictedSessionRunner or Framework#doPrivileged) outside the unrestricted context throws the following exception if the data model including the property hasn't been loaded before: "NuxeoException: The DocumentModel is not associated to an open CoreSession" Possible solutions are: Fetch the property instead of the whole document inside the unrestricted code (queryAndFetch). Call detach(true) on the document within the unrestricted code. Prefetch the schema declaring the property.

      Description

      NXP-3529 introduced org.nuxeo.ecm.core.strictlazyloading to prevent from automatically re-attaching a detached document when using DocumentModel APIs that doing lazy loading (datamodel, system property, lock, acl, lifecycle).

      This means that we re-create temporary sessions at code locations not well determined, which prevents good analysis of session usage.

      —> prevent automatic reconnect of a DocumentModel. A DocumentModel should be either used in the context where its session is still open, or it should be explicitly detached.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: