This project is a sample program with a JDBC DAO to access an H2 database.
Usage :
- Execute
StartH2to launch a H2 server and create the database. - Execute
Appto test the DAO (see source code for DAO usage).
Two entities are manipulated Chien and Personne both implements the interface Entity to ensure that they provide access to a long id.
The simple DAO is defined in the generic interface DAO<E extends Entity>, common parts (find, findAll, persist, remove, update) are implemented in AbstractDAO.
Concrete DAOs for each entity (chienDAOand personDAO) extends AbstractDAO and call methods from the superclass after setting the specific parameters.
The connections to the database are managed by DBCPDataSource, parameters are set by system properties (see resources/app.properties).