List of usage examples for javax.persistence EntityNotFoundException getCause
public synchronized Throwable getCause()
From source file:fr.xebia.demo.wicket.blog.service.GenericService.java
@SuppressWarnings("unchecked") public T get(Serializable id) throws ServiceException { try {/*w w w . j a v a 2 s . c o m*/ EntityManager entityManager = currentEntityManager(); T object = entityManager.find(getObjectClass(), id); if (object == null) { throw new ServiceException("Object Not Found (id=" + id + ')'); } return object; } catch (EntityNotFoundException e) { logger.error(e.getCause(), e); throw new ServiceException("Object Not Found (id=" + id + ')', e); } catch (PersistenceException e) { logger.error(e.getCause(), e); throw new ServiceException("Can't retreive object", e); } finally { closeEntityManager(); } }