File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Object Relational Mapping
Do we need DAO layer
Joined: Aug 03, 2006
Oct 06, 2008 09:22:00
Do we really need DAO layer if working with Hibernate, JPA or any other mapping framework. I had long discussion on this topic .....
Some says yes, but I donot know why??? just for HIbernateTemplate.save() or EntityManager.persist(), ?
Is this not a good design decision to omit DAO layer and let the Frameork do their jobs like generating SQL behind the secene, resource management.
Joined: Apr 16, 2008
Oct 06, 2008 13:42:00
A well-designed DAO layer will enable loose/low coupling between data access logic, transaction management logic and business logic code.
Business object model classes containing business logic should not have data access code mixed in with the business logic. Data access logic involves much more than ".save" or ".persist" methods.
Ideally, business objects should have zero syntax-level dependencies upon commercial or open-source frameworks.
It is poor design and bad form to not have a DAO layer. The reasons and rationales are spelled out in documentation for the Data Access Object design
I agree. Here's the link:
subject: Do we need DAO layer
Spring Hibernate Transaction
BMP + DAO or CMP ?????
spring and hibernate
How to pass the DTO to the dao implementention layer
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015