public void testVariables() { // save a variable final ExecutionService executionService = processEngine.getExecutionService(); // the used process doesn´t matter, I only need an executionId to store / read a Variable final ProcessInstance processInstance = executionService.startProcessInstanceByKey("PtoBM"); final String executionId = processInstance.getId(); final String variableName = "name"; final String variableValue = "value"; executionService.setVariable(executionId, variableName, variableValue); // read Variable final CommandService commandService = processEngine.get(CommandService.class); commandService.execute(new Command() { public Object execute(final Environment environment) throws Exception { final DbSession dbSession = environment.get(DbSession.class); final ClientExecution execution = dbSession.findExecutionById(executionId); final Variable variable = ((ScopeInstanceImpl) execution).getVariableObject(variableName); // validate value final Object value = variable.getValue(); assertEquals(variableValue, value); // validate textValue final String textValue = variable.getTextValue(); // next line fails, cause hibernate instantiate the Variable over field access! assertEquals(variableValue, textValue); return null; } }); }