wood burning stoves*
The moose likes Java in General and the fly likes Master DAO or many DAOs ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Master DAO or many DAOs ?" Watch "Master DAO or many DAOs ?" New topic
Author

Master DAO or many DAOs ?

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

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
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30585
    
154

John,
There is no right or wrong here. It's a matter of personal preference.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jaime M. Tovar
Ranch Hand

Joined: Mar 28, 2005
Posts: 133
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.


She will remember your heart when men are fairy tales in books written by rabbits.<br /> As long as there is duct tape... there is also hope.
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

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
Pavel Kubal
Ranch Hand

Joined: Mar 13, 2004
Posts: 356
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.
 
GeeCON Prague 2014
 
subject: Master DAO or many DAOs ?