Details

      Description

      Hi,

      A StaleObjectStateException will be shown in logs when a service try to update a Layout that are not equals than Layout saved into hibernate session:

      Caused by: com.liferay.portal.kernel.dao.orm.ORMException: {mvccVersion=4, uuid=33a0ff61-953a-fad5-125c-4156637a6554, plid=36883, groupId=36687, companyId=20099, userId=20139, userName=, createDate=Wed Oct 24 15:21:39 GMT 2018, modifiedDate=Thu Oct 25 08:46:13 GMT 2018, privateLayout=false, layoutId=3, parentLayoutId=0, name=<?xml version='1.0' encoding='UTF-8'?><root available-locales="en_US" default-locale="en_US"><Name language-id="en_US">forms</Name></root>, title=, description=, keywords=, robots=, type=portlet, typeSettings=CUSTOMIZABLE_LAYOUT=false
      column-1-customizable=false
      column-2=com_liferay_dynamic_data_mapping_form_web_portlet_DDMFormPortlet_INSTANCE_RbPDIMmVdzH9
      column-2-customizable=false
      layout-template-id=2_columns_ii
      layoutPageTemplateEntryId=0
      layoutUpdateable=true
      sitemap-changefreq=daily
      sitemap-include=1
      , hidden=false, friendlyURL=/forms, iconImageId=0, themeId=classic_WAR_classictheme, colorSchemeId=, css=, priority=2, layoutPrototypeUuid=, layoutPrototypeLinkEnabled=false, sourcePrototypeLayoutUuid=, lastPublishDate=null} is stale in comparison to {mvccVersion=5, uuid=33a0ff61-953a-fad5-125c-4156637a6554, plid=36883, groupId=36687, companyId=20099, userId=20139, userName=, createDate=2018-10-24 15:21:39.381, modifiedDate=2018-10-25 08:46:13.569, privateLayout=false, layoutId=3, parentLayoutId=0, name=<?xml version='1.0' encoding='UTF-8'?><root available-locales="en_US" default-locale="en_US"><Name language-id="en_US">forms</Name></root>, title=, description=, keywords=, robots=, type=portlet, typeSettings=CUSTOMIZABLE_LAYOUT=false
      column-1-customizable=false
      column-2=com_liferay_dynamic_data_mapping_form_web_portlet_DDMFormPortlet_INSTANCE_RbPDIMmVdzH9
      column-2-customizable=false
      layout-template-id=2_columns_ii
      layoutPageTemplateEntryId=0
      layoutUpdateable=true
      sitemap-changefreq=daily
      sitemap-include=1
      , hidden=false, friendlyURL=/forms, iconImageId=0, themeId=classic_WAR_classictheme, colorSchemeId=, css=, priority=2, layoutPrototypeUuid=, layoutPrototypeLinkEnabled=false, sourcePrototypeLayoutUuid=, lastPublishDate=null}
      	at com.liferay.portal.dao.orm.hibernate.ExceptionTranslator.translate(ExceptionTranslator.java:46)
      	at com.liferay.portal.dao.orm.hibernate.SessionImpl.merge(SessionImpl.java:226)
      	at com.liferay.portal.kernel.dao.orm.ClassLoaderSession.merge(ClassLoaderSession.java:394)
      	at com.liferay.portal.service.persistence.impl.LayoutPersistenceImpl.updateImpl(LayoutPersistenceImpl.java:11968)
      	... 237 more
      Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.liferay.portal.model.impl.LayoutImpl#36883]
      	at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:485)
      	at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:255)
      	at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:84)
      	at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:867)
      	at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:851)
      	at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:855)
      	at com.liferay.portal.dao.orm.hibernate.SessionImpl.merge(SessionImpl.java:223)
      	... 239 more
      

      This behavior can be reproduced using the attached Groovy script that trying to fetch, update and update again the same Layout. This script will reproduce this issue due to Layout, for the last update, is different than current Layout saved in hibernate session when it's fetched and updated for the first time. To use this script, an initialization for long plid = -1L; needs to be done with an existing plid from Layout table.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  29 weeks, 1 day ago