em = AppCatalogJPAUtils.getEntityManager();
em.getTransaction().begin();
if (existingApplicationOutput != null) {
existingApplicationOutput.setInterfaceID(interfaceID);
ApplicationInterface applicationInterface = em.find(ApplicationInterface.class, interfaceID);
existingApplicationOutput.setApplicationInterface(applicationInterface);
existingApplicationOutput.setDataType(dataType);
existingApplicationOutput.setOutputKey(outputKey);
existingApplicationOutput.setOutputVal(outputVal);
em.merge(existingApplicationOutput);
} else {
ApplicationOutput applicationOutput = new ApplicationOutput();
applicationOutput.setInterfaceID(interfaceID);
ApplicationInterface applicationInterface = em.find(ApplicationInterface.class, interfaceID);
applicationOutput.setApplicationInterface(applicationInterface);
applicationOutput.setDataType(dataType);
applicationOutput.setOutputKey(outputKey);
applicationOutput.setOutputVal(outputVal);
em.persist(applicationOutput);