コード例 #1
0
 @Override
 public void deleteAuthor(int id) {
   // entityManager.getTransaction().begin();
   Author author = new Author();
   author.setId(id);
   dao.delete(author);
   // entityManager.getTransaction().commit();
 }
コード例 #2
0
 @Override
 public String getAuthorFirstName(int id) {
   Author author = dao.findById(id);
   if (author != null) {
     return author.getFirstName();
   }
   return null;
 }
コード例 #3
0
 @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();
 }