Hello,i just figured out that JPA entities are defined as not cachable in JPAEntityVariableType.I have the following use case where this is a real problem:i use JSF/activiti-cdi, in the JSF based user task views i use things like:
<customer:detail customer="#{processVariables['order'].customer}" />
I observed that the entity 'customer', and its related entity 'address' is updated correctly when i modify values in the JSF view and execute
<h:commandButton id="complete" value="#{msg.completeTaskButton}" action="#{businessProcess.completeTask(true)}" />
Following the user task there are service tasks which works on the process variable 'order'.But when i execute code like
@Override
public void execute(DelegateExecution execution) throws Exception {
Order order = (Order) execution.getVariable(VariableNames.ORDER);
}
i see that the values set on the entities just before in the user task are not there. The reason is that in VariableInstanceEntity the following happens:
public Object getValue() {
if (!type.isCachable() || cachedValue==null) {
cachedValue = type.getValue(this);
}
return cachedValue;
}
In the 'order' referenced by cachedValue i see the modified entity from the user task, but due to the fact that JPAEntityVariableType is not cachableit is read from the database and all modifications are lost.Is this the expected behavior for JPA process variables?If so, how can i solve this issue?ThanksChris