lazy loading outside command context
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2013 01:14 PM
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:
What can be the cause of this?
Thanks…
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…
Labels:
- Labels:
-
Archive
4 REPLIES 4

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2013 06:11 AM
You should use the Activiti Service API to access the variable data or setup a command context yourself. So the easiest approach would be to get the variable data through the RuntimeService API.
Best regards,
Best regards,
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2013 07:38 AM
Hi Tijs,
Thank you but how can I get variable through RuntimeService API? As far as I know, HistoryService API is responsible for that. I couldn't get it sorry.
Thank you but how can I get variable through RuntimeService API? As far as I know, HistoryService API is responsible for that. I couldn't get it sorry.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2013 04:11 AM
RuntimeService.getVariableXX methods? That only applies when the process is still running.
Once the process instance is ended, you need to use the historyService. Also make sure that your history level is on a high enough level that the process variables are captured (default history level captures them).
Once the process instance is ended, you need to use the historyService. Also make sure that your history level is on a high enough level that the process variables are captured (default history level captures them).
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2013 09:10 AM
My bad, sorry. I've only looked RuntimeService.createXXQuery methods. I'll give it a try and let you know.
