AnsweredAssumed Answered

lazy loading outside command context

Question asked by gokceng1 on Dec 22, 2013
Latest reply on Dec 24, 2013 by gokceng1
Hello,
I've faced an exception, the one stated in topic.
I've been working on same code for a week. I've updated the code outside the activity related things but as a result I'm having this problem.

The code is like that:


public Data getDataFromExecutionId(String executionId) {
   ExecutionEntity executionEntity = (ExecutionEntity) getRuntimeService().createExecutionQuery().executionId(executionId).singleResult(); //this returns a process instance

   if (executionEntity == null) {
      return null;
   }
   String orderDataPlaceholderName = getPropertySourcesPlaceHolderConfigurer().resolvePlaceholder(VariableNameConstants.ORDER_DATA_EXP_NAME);
   Data data = (Data) executionEntity.getVariable(orderDataPlaceholderName); //this line throws "lazy loading outside command context"
}


org.activiti.engine.ActivitiException: lazy loading outside command context
   at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.ensureVariableInstancesInitialized(VariableScopeImpl.java:58)
   at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.getVariable(VariableScopeImpl.java:84)
   at …SimpleProcessManager.getDataFromExecutionId(SimpleProcessManager.java:77)

What can be the cause of this?

Thanks…

Outcomes