In the source code of VariableCreate.java
HistoryTaskImpl historyTask = null; TaskImpl task = variable.getTask(); if (task!=null) { long taskDbid = task.getDbid(); historyTask = (HistoryTaskImpl) dbSession.get(HistoryTaskImpl.class, taskDbid); } HistoryVariableImpl historyVariable = new HistoryVariableImpl(historyProcessInstance, historyTask, variable);
but In my case the taskImpl id may be not the same with HistoryTaskImpl id