Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-31975

deletePortletPreferences() from velocity editor to delete preferences of nested portlets.

    Details

      Description

      Currently, Liferay saves portlet preferences in the database. However, this means that it is impossible to override these portlet/page preferences even with custom code.
      The only way to change page/portlet preferences once they are set is to call deletePortletPreferences() to delete the entry from the database, then use another method to write the preferred preferences.

      Some however, using deletePortletPreferences() to delete directly from the database can result in an "org.hibernate.StaleStateException". This might be caused by a race condition between the cache refreshing and Liferay trying to read the portlet preferences, though this is just a guess since debugging does not trigger the StaleStateException.

      An improvement would be to create a way to clear or override the saved preference through the code, something like:

      $velocityPortletPreferences.setValue("override-saved-preferences", "true")
      

      This way, one would not need to make database calls and potentially cause a race condition.

        Attachments

          Activity

            People

            • Assignee:
              support-lep@liferay.com SE Support
              Reporter:
              christopher.lui Christopher Lui
            • Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Packages

                Version Package