All the DAO examples I've read have DaoFactory classes that always return
a new DAO instance, and typically the action using it keeps a handle to it
for that session.

The DAOs that I've created have no state or instance variables, and get
their connections from a synchronized pool (and always returning the
connection within the same method call). So, since they are
multi-threaded, it makes sense to me performance wise it is better
for the factory to always return a singleton instance of the DAO.
This single instance of the DAO is shared across all sessions in
the JVM.
(Note this is not the traditional usage of singleton where the singleton
itself is responsible for returning the single instance through a static
method).

My question is, is this such a good idea? Am I missing or misunderstanding
something crucial about the DAO Design Pattern?

Mick.

-- 
<BR/>
"We all may have come on different ships, but we’re in the same boat now." 
Martin Luther King. Jr.
<BR/>
 --- <a href=http://www.harryspractice.com.au>www.harryspractice.com.au</a> --- 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to