We use hibernate in our application and like to use DAO pattern to implement the data layer of application. I have seen some suggestions on using ValueObjects/DTOs to return data from DAOs
public interface EmployeeDAO {
List<EmployeeDTO> getEmployees();
}
What is the advantage of returning ValueObjects/DTOs instead of returning hibernate domain objects as
public interface EmployeeDAO {
List<Employee> getEmployees();
}
Is it not a overkill to copy the data from hibernate object to value object and have two copies of same data in memory. What advantage does ValueObjects really add ?
Are ValueObjects just preferred between business and view layers are should these be used in DAOs
Thanks for any suggestions
Siva