hi,
In this example:
public void init() throws ServletException {
bookDB = (BookDBAO) getServletContext()
.getAttribute("bookDB");
if (bookDB == null) {
throw new UnavailableException("Couldn't get database.");
}
}
As it is not instantiating the BookDBAO instance and the connection with entity manager is done in the constructor:
public class BookDBAO {
private ArrayList books;
private EntityManager em;
public BookDBAO(EntityManagerFactory emf) throws Exception {
em = emf.createEntityManager();
try {
} catch (Exception ex) {
throw new Exception(
"Couldn't open connection to database: " + ex.getMessage());
}
}
The where and how is this BookDBAO being instantiated? Thanks.