Class JPABookDAOImpl

  • All Implemented Interfaces:
    BookDAO

    public class JPABookDAOImpl
    extends Object
    implements BookDAO
    This class provides a simple DAO implementation based on JPA
    • Constructor Detail

      • JPABookDAOImpl

        public JPABookDAOImpl()
    • Method Detail

      • setEntityManager

        public void setEntityManager​(EntityManager em)
      • create

        public Book create​(Book book)
        Description copied from interface: BookDAO
        Add the book to the database.
        Specified by:
        create in interface BookDAO
      • update

        public Book update​(Book book)
        Description copied from interface: BookDAO
        Updates the book in the database with the values in this object.
        Specified by:
        update in interface BookDAO
      • get

        public Book get​(long id)
        Description copied from interface: BookDAO
        Gets a book from the database by its ID.
        Specified by:
        get in interface BookDAO
      • remove

        public void remove​(Book book)
        Description copied from interface: BookDAO
        Removes a book from the database.
        Specified by:
        remove in interface BookDAO
      • findAll

        public List<Book> findAll​(int offset,
                                  int limit)
        Description copied from interface: BookDAO
        Returns a collection of books, starting at the index provided and limiting the collection to the count value.
        Specified by:
        findAll in interface BookDAO