@Override
public void save() throws AppCatalogException {
EntityManager em = null;
try {
em = AppCatalogJPAUtils.getEntityManager();
JobSubmissionInterface existingJobSubmissionInterface = em.find(JobSubmissionInterface.class, new JobSubmissionInterface_PK(jobSubmissionInterfaceId, computeResourceId));
em.close();
JobSubmissionInterface jobSubmissionInterface;
em = AppCatalogJPAUtils.getEntityManager();
em.getTransaction().begin();
if (existingJobSubmissionInterface == null) {
jobSubmissionInterface = new JobSubmissionInterface();
} else {
jobSubmissionInterface = existingJobSubmissionInterface;
}
jobSubmissionInterface.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
jobSubmissionInterface.setComputeResourceId(getComputeResourceId());
ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
jobSubmissionInterface.setComputeResource(computeResource);
jobSubmissionInterface.setJobSubmissionProtocol(getJobSubmissionProtocol());
jobSubmissionInterface.setPriorityOrder(getPriorityOrder());
if (existingJobSubmissionInterface == null) {
em.persist(jobSubmissionInterface);
} else {
em.merge(jobSubmissionInterface);
}