use of javax.persistence.EntityNotFoundException in project OpenAttestation by OpenAttestation.
the class TblPcrManifestJpaController method destroy.
public void destroy(Integer id) throws NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblPcrManifest tblPcrManifest;
try {
tblPcrManifest = em.getReference(TblPcrManifest.class, id);
tblPcrManifest.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblPcrManifest with id " + id + " no longer exists.", enfe);
}
// @since 1.1 we are relying on the audit log for "created on", "created by", etc. type information
/*
TblDbPortalUser updatedBy = tblPcrManifest.getUpdatedBy();
if (updatedBy != null) {
updatedBy.getTblPcrManifestCollection().remove(tblPcrManifest);
em.merge(updatedBy);
}
TblDbPortalUser createdBy = tblPcrManifest.getCreatedBy();
if (createdBy != null) {
createdBy.getTblPcrManifestCollection().remove(tblPcrManifest);
em.merge(createdBy);
}
*/
TblMle mleId = tblPcrManifest.getMleId();
if (mleId != null) {
mleId.getTblPcrManifestCollection().remove(tblPcrManifest);
em.merge(mleId);
}
em.remove(tblPcrManifest);
em.getTransaction().commit();
} finally {
em.close();
}
}
use of javax.persistence.EntityNotFoundException in project OpenAttestation by OpenAttestation.
the class TblModuleManifestLogJpaController method destroy.
public void destroy(Integer id) throws NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblModuleManifestLog tblModuleManifestLog;
try {
tblModuleManifestLog = em.getReference(TblModuleManifestLog.class, id);
tblModuleManifestLog.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblModuleManifestLog with id " + id + " no longer exists.", enfe);
}
TblTaLog taLogId = tblModuleManifestLog.getTaLogId();
if (taLogId != null) {
taLogId.getTblModuleManifestLogCollection().remove(tblModuleManifestLog);
em.merge(taLogId);
}
em.remove(tblModuleManifestLog);
em.getTransaction().commit();
} finally {
em.close();
}
}
use of javax.persistence.EntityNotFoundException in project OpenAttestation by OpenAttestation.
the class TblHostsJpaController method destroy.
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblHosts tblHosts;
try {
tblHosts = em.getReference(TblHosts.class, id);
tblHosts.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblHosts with id " + id + " no longer exists.", enfe);
}
TblMle vmmMleId = tblHosts.getVmmMleId();
if (vmmMleId != null) {
vmmMleId.getTblHostsCollection().remove(tblHosts);
em.merge(vmmMleId);
}
TblMle biosMleId = tblHosts.getBiosMleId();
if (biosMleId != null) {
biosMleId.getTblHostsCollection().remove(tblHosts);
em.merge(biosMleId);
}
em.remove(tblHosts);
em.getTransaction().commit();
} finally {
em.close();
}
}
use of javax.persistence.EntityNotFoundException in project OpenAttestation by OpenAttestation.
the class TblLocationPcrJpaController method destroy.
public void destroy(Integer id) throws NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblLocationPcr tblLocationPcr;
try {
tblLocationPcr = em.getReference(TblLocationPcr.class, id);
tblLocationPcr.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblLocationPcr with id " + id + " no longer exists.", enfe);
}
em.remove(tblLocationPcr);
em.getTransaction().commit();
} finally {
em.close();
}
}
use of javax.persistence.EntityNotFoundException in project OpenAttestation by OpenAttestation.
the class TblSamlAssertionJpaController method destroy.
public void destroy(Integer id) throws NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblSamlAssertion tblSamlAssertion;
try {
tblSamlAssertion = em.getReference(TblSamlAssertion.class, id);
tblSamlAssertion.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblSamlAssertion with id " + id + " no longer exists.", enfe);
}
TblHosts hostId = tblSamlAssertion.getHostId();
if (hostId != null) {
hostId.getTblSamlAssertionCollection().remove(tblSamlAssertion);
em.merge(hostId);
}
em.remove(tblSamlAssertion);
em.getTransaction().commit();
} finally {
em.close();
}
}
Aggregations