I am trying to create a stand-alone user task which is not associated with any process instance. How could I create local variables to be associated with the new task?Using the code below we can create and persist the task, but the last call 'CreateVariablesLocal' causes 'lazy loading outside command context' exception due to context check in class 'VariableScopeImpl' method 'ensureVariableInstancesInitialized'.Please advise!<!–break–>
TaskEntity taskEntity = (TaskEntity) taskService.newTask();
taskEntity.setCategory(…);
taskEntity.setDescription(…);
taskEntity.setDueDate(…);
taskEntity.setName(…);
taskEntity.setOwner(…);
taskEntity.setPriority(…);
taskEntity.setTenantId(…);
taskService.saveTask(taskEntity);
taskEntity.createVariablesLocal(… map with variable keys and values …);
org.activiti.engine.ActivitiException: lazy loading outside command context
at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.ensureVariableInstancesInitialized(VariableScopeImpl.java:65)
at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.createVariableLocal(VariableScopeImpl.java:746)