4142434445464748495051
} public void delete(Author author) { EntityManager em = entityManager(); try { Author attached = em.find(Author.class, author.getId()); em.remove(attached); } catch (Exception e) { e.printStackTrace(); } finally { em.close();
5758596061626364656667
if (id == null) { return null; } EntityManager em = entityManager(); try { Author author = em.find(Author.class, id); return author; } catch (Exception e) { e.printStackTrace(); return null; } finally {
6869707172737475
em.close(); } } public Author find(Long id) { Author author = find(Author.class, id); return author; }