@Override
public void save() throws AppCatalogException {
EntityManager em = null;
try {
em = AppCatalogJPAUtils.getEntityManager();
ApplicationModule existingModule = em.find(ApplicationModule.class, moduleId);
em.close();
em = AppCatalogJPAUtils.getEntityManager();
em.getTransaction().begin();
if (existingModule != null){
existingModule.setModuleName(moduleName);
existingModule.setModuleVersion(moduleVersion);
existingModule.setModuleDesc(moduleDesc);
em.merge(existingModule);
}else {
ApplicationModule applicationModule = new ApplicationModule();
applicationModule.setModuleID(moduleId);
applicationModule.setModuleName(moduleName);
applicationModule.setModuleVersion(moduleVersion);
applicationModule.setModuleDesc(moduleDesc);
em.persist(applicationModule);
}
em.getTransaction().commit();
em.close();
} catch (Exception e) {