1 package ejava.examples.daoex.dao;
2
3 import java.util.List;
4 import javax.persistence.PersistenceException;
5 import ejava.examples.daoex.bo.Book;
6
7 /**
8 * This interface provides an example DAO interface for a Book. Note that
9 * the technology associate with the DAO should not be exposed in this
10 * interface.
11 */
12 public interface BookDAO {
13 /**
14 * Add the book to the database.
15 */
16 Book create(Book book) throws PersistenceException;
17
18 /**
19 * Updates the book in the database with the values in this object.
20 */
21 Book update(Book book) throws PersistenceException;
22
23 /**
24 * Gets a book from the database by its ID.
25 */
26 Book get(long id) throws PersistenceException;
27
28 /**
29 * Removes a book from the database.
30 */
31 void remove(Book book) throws PersistenceException;
32
33 /**
34 * Returns a collection of books, starting at the index provided and
35 * limiting the collection to the count value.
36 */
37 List<Book> findAll(int start, int count) throws PersistenceException;
38 }