-
Type:
Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: Master
-
Fix Version/s: 7.0.0 DXP SP2, 7.0.0 DXP FP13, 7.0.0 DXP SP3, 7.0.3 CE GA4, 7.1.X, Master
-
Component/s: Core Infrastructure
-
Branch Version/s:7.0.x
-
Backported to Branch:Committed
-
Story Points:1
-
Git Pull Request:
This is problem we found while moving Liferay Connected Services to 7.0 platform:
From the code:
Layout layout = layoutPersistence.findByG_P_L(
groupId, privateLayout, layoutId);
layout.setModifiedDate(now);
layout.setThemeId(themeId);
layout.setColorSchemeId(colorSchemeId);
layout.setCss(css);
layoutPersistence.update(layout);
return layout;
Returned Layout object is staled, as underlying update call would change reference of passed object, perform changes on it and return completely new object.
Problem results in Hibernate's StaleObjectException if caller tries to update layout object after calling LayoutLocalService.updateLookAndFeel
The fix should be very easy, return result of layoutPersistance.update.
Exceptions:
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#20146] Caused by: com.liferay.portal.kernel.exception.SystemException: com.liferay.portal.kernel.dao.orm.ORMException: {mvccVersion=60, uuid=89ee3df2-3ecc-2466-694d-2771fddc62dd, plid=20146, groupId=20143, companyId=20116, userId=20120, userName=, createDate=Thu Feb 16 14:36:26 GMT 2017, modifiedDate=Wed Feb 22 08:39:08 GMT 2017, privateLayout=false, layoutId=1, parentLayoutId=0, name=<?xml version='1.0' encoding='UTF-8'?><root available-locales="en_US" default-locale="en_US"><Name language-id="en_US">Welcome</Name></root>, title=, description=, keywords=, robots=, type=portlet, typeSettings=layout-template-id=1_column_layoutUpdateable=true_, hidden=false, friendlyURL=/home, iconImageId=0, themeId=osblcs_WAR_osblcstheme, colorSchemeId=01, css=, priority=0, layoutPrototypeUuid=, layoutPrototypeLinkEnabled=false, sourcePrototypeLayoutUuid=, lastPublishDate=null} is stale in comparison to {mvccVersion=61, uuid=89ee3df2-3ecc-2466-694d-2771fddc62dd, plid=20146, groupId=20143, companyId=20116, userId=20120, userName=, createDate=2017-02-16 14:36:26.704, modifiedDate=2017-02-22 08:39:08.093, privateLayout=false, layoutId=1, parentLayoutId=0, name=<?xml version='1.0' encoding='UTF-8'?><root available-locales="en_US" default-locale="en_US"><Name language-id="en_US">Welcome</Name></root>, title=, description=, keywords=, robots=, type=portlet, typeSettings=column-1=com_liferay_login_web_portlet_LoginPortlet,_layout-template-id=1_column_layoutUpdateable=true_, hidden=false, friendlyURL=/home, iconImageId=0, themeId=osblcs_WAR_osblcstheme, colorSchemeId=01, css=, priority=0, layoutPrototypeUuid=, layoutPrototypeLinkEnabled=false, sourcePrototypeLayoutUuid=, lastPublishDate=null} [Sanitized]