Package ejava.examples.daoex.dao
Class JPABookDAOImpl
- java.lang.Object
-
- ejava.examples.daoex.dao.JPABookDAOImpl
-
-
Field Summary
Fields Modifier and Type Field Description private EntityManager
em
-
Constructor Summary
Constructors Constructor Description JPABookDAOImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Book
create(Book book)
Add the book to the database.List<Book>
findAll(int offset, int limit)
Returns a collection of books, starting at the index provided and limiting the collection to the count value.Book
get(long id)
Gets a book from the database by its ID.void
remove(Book book)
Removes a book from the database.void
setEntityManager(EntityManager em)
Book
update(Book book)
Updates the book in the database with the values in this object.
-
-
-
Field Detail
-
em
private EntityManager em
-
-
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.
-
update
public Book update(Book book)
Description copied from interface:BookDAO
Updates the book in the database with the values in this object.
-
get
public Book get(long id)
Description copied from interface:BookDAO
Gets a book from the database by its ID.
-
remove
public void remove(Book book)
Description copied from interface:BookDAO
Removes a book from the database.
-
-