• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Master DAO or many DAOs ?

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
In my application, I have domain objects like : Book, Author, Publisher (I'm using Hibernate)....
I created interfaces like BookDAO, AuthorDAO and then implement them using HibernateDaoSupport.
But while I'm coding my DAO's, a question came into my mind :
Is it good to many DAOs (like my case) or to create a master DAO called for example :
BookStoreDAO ?
What is the right approach here ?
Thanks folks
 
author & internet detective
Posts: 39348
755
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,
There is no right or wrong here. It's a matter of personal preference.
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recomend many daos if you are planning to reuse your code. You can just take the things you need and leave everything else out of your new project. It is also easier to work when you are doing maintenance because you know exactly in which dao you need to do the corrections.
Well just my opinion.
 
Ranch Hand
Posts: 1170
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have both many daos and then a master dao that most others are obtained from. but that master dao is not really a dao then since its not really about data access but dao access
 
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to add, that there's no wrong and right. There is better and worse (or equal :-) ). And it really depens on what is the target scope.

But from you description, I incline to many DAOs.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!