LOG.trace("LoadEntity call");
T entity = findEntityByCorrelationKey(key);
if (entity == null) {
entity = createEntity(exchange, key);
setKeyProperty(entity, key);
ProcessDefinition definition = ProcessDefinition.getRefreshedProcessDefinition(entityManagerTemplate,
getActivityRules().getProcessRules().getProcessDefinition());
setProcessDefinitionProperty(entity, definition);
entityManagerTemplate.persist(entity);
// Now we must flush to avoid concurrent updates clashing trying to