April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
Instantiate a UserDao Object in Application Code
nUserDaoHibernateImpl userDao = new UserDaoHibernateImpl();
n
nUserDao userDao = new UserDaoHibernateImpl();
n
nWhich one is better??
n
nWhat if we decide to use JDBC instead of Hibernate, i.e. replace UserDaoHibernateImpl with UserDaoJdbcImpl
nThe application is not really independent of the data access method
nSwitching to a different UserDao implementation affects all the code that uses UserDao
The DAO would be injected with a Session/Connection object