Details
-
Bug
-
Status: Closed
-
Resolution: Fixed
-
7.3.X, Master
-
4
-
Database Upgrade
Description
Reproduction steps:
- Start 6.2
- Create a user group
- Assign this user group to the default site and assign a role
- Switch on Local Staging
- Run the script with your values to assign the role to the staged group too:
import com.liferay.portal.service.UserGroupGroupRoleLocalServiceUtil; long userGroupId= ; //your usergroupid long groupId= ; //staging groupid long[] roleIds = [20169]; // the same roleid that you assigned at step 2) UserGroupGroupRoleLocalServiceUtil.addUserGroupGroupRoles( userGroupId, groupId, roleIds);
- Upgrade to 7.3
Expected behaviour: Upgrade finishes with no Exceptions
Actual behaviour: Upgrade finishes with
2021-04-07 17:13:28.433 ERROR [main][JDBCExceptionReporter:234] Duplicate entry '50226948-9287595-11813497-0' for key 'IX_B384D815'
Caused by: org.springframework.dao.DataIntegrityViolationException: could not update: [com.liferay.portal.model.impl.UserGroupGroupRoleImpl#981]; SQL [update UserGroupGroupRole set mvccVersion=?, groupId=? where userGroupGroupRoleId=? and mvccVersion=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not update: [com.liferay.portal.model.impl.UserGroupGroupRoleImpl#981] at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:660) at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:800) at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:671) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:743) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:711) at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.commit(DefaultTransactionExecutor.java:41) at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:77) at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:57) at com.liferay.portal.kernel.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:64) at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:57) at com.liferay.portal.spring.aop.AopInvocationHandler.invoke(AopInvocationHandler.java:49) at com.sun.proxy.$Proxy166.updateUserGroupGroupRole(Unknown Source) at com.liferay.portal.kernel.service.UserGroupGroupRoleLocalServiceUtil.updateUserGroupGroupRole(UserGroupGroupRoleLocalServiceUtil.java:415) at com.liferay.portal.verify.VerifyGroup.verifyStagingUserGroupGroupRolesAssignments(VerifyGroup.java:234) at com.liferay.portal.verify.VerifyGroup.verifyStagedGroups(VerifyGroup.java:83) at com.liferay.portal.verify.VerifyGroup.doVerify(VerifyGroup.java:53) at com.liferay.portal.verify.VerifyProcess.verify(VerifyProcess.java:71) ... 10 more