This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Implementing DAOs as singleton Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Reply Bookmark "Implementing DAOs as singleton" Watch "Implementing DAOs as singleton" New topic
Author

Implementing DAOs as singleton

Rupali Chaudhari
Greenhorn

Joined: Mar 18, 2008
Posts: 2
Hi,

Is it a good idea/standard practice to implement DAO (Data Access Objects) as singleton? If DAOs are implemented as singleton there will be only one instance of a DAO for all users. Other users will have to wait until first user completes the execution of any method of the DAO. So won't it affect the performance? I have same doubt about implementing delegates also.


Thanks in advance
Rupali
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
Welcome to JavaRanch,

Please check your private messages


"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
There are lots of reasons to avoid singletons.

See references listed in Oo Patterns Uml Refactoring Faq: Singleton Pattern.
Rupali Chaudhari
Greenhorn

Joined: Mar 18, 2008
Posts: 2
Hi Peer,

I have updated my display name. Thanks for your reply.

Rupali
[ March 18, 2008: Message edited by: Rupali Chaudhari ]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Implementing DAOs as singleton
 
Similar Threads
Use of DAO as a Command?
Domain objects with no dependencys on DAOs
Master DAO or many DAOs ?
spring mvc singleton="false DAO issues?
DOA as session bean ?