@Override public void deleteAuthor(int id) { // entityManager.getTransaction().begin(); Author author = new Author(); author.setId(id); dao.delete(author); // entityManager.getTransaction().commit(); }
@Override public String getAuthorFirstName(int id) { Author author = dao.findById(id); if (author != null) { return author.getFirstName(); } return null; }
@Override public void createAuthor(int id, String firstName, String lastName) { // entityManager.getTransaction().begin(); Author author = new Author(); author.setId(id); author.setFirstName(firstName); author.setLastName(lastName); dao.persist(author); // entityManager.getTransaction().commit(); }