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);
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)
My results are consistent with yours; I'm not sure if there is a workaround for this. In all cases that I've found or that have worked for me, the 'setId' method is only usable for preemptive setting of a user's ID value - not changing it after it's been saved already.