04-07-2017 05:08 AM
Hi all, I'm interacting with Activiti by using the Activiti Engine 5.20 API.
Is it possible to change the userID (and the groupId) through indentyService?
IdentityService identityService = processEngine.getIdentityService();
org.activiti.engine.identity.User identiUser = identityService.createUserQuery().userId("kermit").singleResult();
identiUser.setId("pipponzo");
identityService.saveUser(identiUser);
It throws
org.activiti.engine.ActivitiOptimisticLockingException: org.activiti.engine.impl.persistence.entity.UserEntity@650ae78c was updated by another transaction concurrently
at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:880)
at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:619)
at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:212)
at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:138)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
at org.activiti.engine.impl.IdentityServiceImpl.saveUser(IdentityServiceImpl.java:65)
at com.jnsw.gesdoc.test.ActivitiUnitTest.updateUserID(ActivitiUnitTest.java:200)
(I think we cannot change userId because it is a key and it cannot retrieve anylong identiUser beacause we've changed the id)
Thanks in advance.
Explore our Alfresco products with the links below. Use labels to filter content by product module.