Hi,
Calling org.activiti.engine.RuntimeService.getVariable causes the corresponding ByteArrayEntity content to be updated and flushed when it is supposed to only be read. Because we are attempting to read the process (and its variables) in multiple transactions, this causes an ActivitiOptimisticLockingException, when in reality, there's nothing we are trying to update, but just access the variable and the data in the ACT_GE_BYTEARRAY for the variable.
Marking it read-only doesn't seem to help - the below doesn't affect the update in any way:
@Transactional (readOnly = true, propagation = Propagation.REQUIRES_NEW)
public Object getRuntimeVariable(String processInstanceId, String name) {
return runtimeService.getVariable(processInstanceId, name);
}
Is there anyway to prevent the flushing from happening in case of reading a variable like this? If not, can we restrict the flushing only to when there's actually a change in data? The data in this variable is a serialized Java object, so would making sure the properties haven't changed be enough to prevent the flushing?
I am on Activiti version 5.13.