use of javax.persistence.EntityNotFoundException in project OpenAttestation by OpenAttestation.
the class TblOemJpaController method destroy.
public void destroy(Integer id) throws NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblOem tblOem;
try {
tblOem = em.getReference(TblOem.class, id);
tblOem.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblOem with id " + id + " no longer exists.", enfe);
}
em.remove(tblOem);
em.getTransaction().commit();
} finally {
em.close();
}
}
use of javax.persistence.EntityNotFoundException in project OpenAttestation by OpenAttestation.
the class TblTaLogJpaController method destroy.
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblTaLog tblTaLog;
try {
tblTaLog = em.getReference(TblTaLog.class, id);
tblTaLog.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblTaLog with id " + id + " no longer exists.", enfe);
}
em.remove(tblTaLog);
em.getTransaction().commit();
} finally {
em.close();
}
}
use of javax.persistence.EntityNotFoundException in project OpenAttestation by OpenAttestation.
the class TblRequestQueueJpaController method destroy.
public void destroy(Integer id) throws NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblRequestQueue tblRequestQueue;
try {
tblRequestQueue = em.getReference(TblRequestQueue.class, id);
tblRequestQueue.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblRequestQueue with id " + id + " no longer exists.", enfe);
}
em.remove(tblRequestQueue);
em.getTransaction().commit();
} finally {
em.close();
}
}
use of javax.persistence.EntityNotFoundException in project API by ca-cwds.
the class AddressService method update.
@Override
public Response update(Serializable primaryKey, Request request) {
assert primaryKey instanceof String;
assert request instanceof gov.ca.cwds.rest.api.domain.cms.Address;
gov.ca.cwds.rest.api.domain.cms.Address address = (gov.ca.cwds.rest.api.domain.cms.Address) request;
try {
String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
Address managed = new Address((String) primaryKey, address, lastUpdatedId);
managed = addressDao.update(managed);
return new gov.ca.cwds.rest.api.domain.cms.Address(managed, true);
} catch (EntityNotFoundException e) {
LOGGER.info("Address not found : {}", address);
throw new ServiceException(e);
}
}
use of javax.persistence.EntityNotFoundException in project API by ca-cwds.
the class AllegationService method update.
/**
* {@inheritDoc}
*
* @see gov.ca.cwds.rest.services.CrudsService#update(java.io.Serializable,
* gov.ca.cwds.rest.api.Request)
*/
@Override
public gov.ca.cwds.rest.api.domain.cms.Allegation update(Serializable primaryKey, Request request) {
assert primaryKey instanceof String;
assert request instanceof gov.ca.cwds.rest.api.domain.cms.Allegation;
gov.ca.cwds.rest.api.domain.cms.Allegation allegation = (gov.ca.cwds.rest.api.domain.cms.Allegation) request;
try {
String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
Allegation managed = new Allegation((String) primaryKey, allegation, lastUpdatedId);
managed = allegationDao.update(managed);
return new gov.ca.cwds.rest.api.domain.cms.Allegation(managed);
} catch (EntityNotFoundException e) {
LOGGER.info("Allegation not found : {}", allegation);
throw new ServiceException(e);
}
}
Aggregations