need of DAO factory
Hi
I was reading about DAO patterns in various threads here and some examples of the implementation.
There is one thing I am not clear with, is the use of DAO factory.
why can't we do
daoObj = new DAOClass() ; wherever we want to use it instead of the factory method returning the same
TIA
[329 byte] By [
am_newa] at [2007-10-2 12:11:44]

> Hi
>
> I was reading about DAO patterns in various threads
> here and some examples of the implementation.
>
> There is one thing I am not clear with, is the use of
> DAO factory.
>
> why can't we do
> daoObj = new DAOClass() ; wherever we want to use it
> instead of the factory method returning the same
>
> TIA
you can, but you tie your business objects to the persistence mechanism you're using (IOW : the DAO class).
for a quite comprehensive discussion about its benefits :
[url=http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html]Data Access Objects[/url]