April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
UserDao – Usage in Application Code
nUser instructor = userDao.getUserById( instructorId ) );
nSection section = sectionDao.getSectionById( sectionId );
nsection.addInstructor( instructor );
nsectionDao.saveSection( section );
n
nAdvantages of DAO
nProvide a data access API that is
nIndependent of persistent storage types, e.g. relational DB, OODB, XML flat files etc.
nIndependent of persistent storage implementations, e.g. MySQL, PostgreSQL, Oracle etc.
nIndependent of data access
nimplementations, e.g. JDBC, Hibernate, JDO, etc.
The DAO would be injected with a Session/Connection object