Howdy fellow
Java software engineers,
This is not really a question concerning some kind of problem, but this is mainly an attempt to explore opinions and views regarding best practices.
Currently I'm working on a project in which I have choosen to implement the DAO design
pattern, including a DAO Abstract Factory to facilitate the opportunity for datasource replacement (which, for this specific project, is likely to happen in the near future).
I have consulted the
tutorial for the implementation of this design pattern as provided by the Core
J2EE Pattern Catalog in which it is suggested to open (and close) a connection for every single query that is invoked through a method within a DAO.
However, would it not be better practice to open and maintain one single connection that is shared among all DAO's? The abstract factory could provide the instance of the connection object to the DAO's.
What are your opinions and views?
Thanks in advance!
Kind regards,
Jeroen Oosterlaar
[ February 11, 2007: Message edited by: Jeroen Oosterlaar ]
[ February 11, 2007: Message edited by: Jeroen Oosterlaar ]