public void setValue(Object value, ValueFields valueFields) { EntityManagerSession entityManagerSession = Context.getCommandContext().getSession(EntityManagerSession.class); if (entityManagerSession == null) { throw new ActivitiException("Cannot set JPA variable: " + EntityManagerSession.class + " not configured"); } else { // Before we set the value we must flush all pending changes from // the entitymanager // If we don't do this, in some cases the primary key will not yet // be set in the object // which will cause exceptions down the road. entityManagerSession.flush(); } if (value != null) { String className = mappings.getJPAClassString(value); String idString = mappings.getJPAIdString(value); valueFields.setTextValue(className); valueFields.setTextValue2(idString); } else { valueFields.setTextValue(null); valueFields.setTextValue2(null); } }
public void setValue(Object value, ValueFields valueFields) { EntityManagerSession entityManagerSession = Context .getCommandContext() .getSession(EntityManagerSession.class); if (entityManagerSession == null) { throw new ActivitiException("Cannot set JPA variable: " + EntityManagerSession.class + " not configured"); } else { // Before we set the value we must flush all pending changes from the entitymanager // If we don't do this, in some cases the primary key will not yet be set in the object // which will cause exceptions down the road. entityManagerSession.flush(); } if(value != null) { String className = mappings.getJPAClassString(value); String idString = mappings.getJPAIdString(value); valueFields.setTextValue(className); valueFields.setTextValue2(idString); } else { valueFields.setTextValue(null); valueFields.setTextValue2(null); } }
public void setValue(Object value, ValueFields valueFields) { EntityManagerSession entityManagerSession = Context.getCommandContext().getSession(EntityManagerSession.class); if (entityManagerSession == null) { throw new ActivitiException("Cannot set JPA variable: " + EntityManagerSession.class + " not configured"); } else { // Before we set the value we must flush all pending changes from // the entitymanager // If we don't do this, in some cases the primary key will not yet // be set in the object // which will cause exceptions down the road. entityManagerSession.flush(); } if (value != null) { String className = mappings.getJPAClassString(value); String idString = mappings.getJPAIdString(value); valueFields.setTextValue(className); valueFields.setTextValue2(idString); } else { valueFields.setTextValue(null); valueFields.setTextValue2(null); } }