• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Do we need DAO layer

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 pattern.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic