J2EE DAO Pattern
From: Chuck (cmedcoff_at_hotmail.com)
Date: 12/18/04
- Next message: Alan Gauld: "Re: OOA and OOD"
- Previous message: James D Carroll: "comp.lang.uml ?"
- Next in thread: Michael Rauscher: "Re: J2EE DAO Pattern"
- Reply: Michael Rauscher: "Re: J2EE DAO Pattern"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 18 Dec 2004 10:47:20 -0500
I've recently read the J2EE DAO Pattern on Sun's website at
http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html.
There is use of GOF patterns here, but there is at least two things that I
do not like about this pattern or at least the code example of it. The
first thing is that the DAOFactory defines a few public static final int's
for parmeterizing the getDAOFactory() method. This seem to some extent
violate OCP. DAOFactory's pulic interface is note closed if new underlying
datasources must be defined. The second thing that I don't like comes from
the standpoint of testing. The DAOFactory's getDAOFactory() method
restricts DAO's use only a certain particular data source at one time. This
would not allow one to use combinations say a of an ORACLE DAO for one set
of domain objects and a testing sub for another if one so desired.
As an alternative it seems that use of some sort of DAORegistry where an
applications "main" could populate the registry with any combinations of
data source DAO's would allow a bit more flexibility. One drawback to this
would be that unless DAORegistry client's called a clone method on DAOs in
the registry, the clients would have to share DAO objects. Perhaps not a
problem if the DAO's are stateless/threadsafe.
Comments?
- Next message: Alan Gauld: "Re: OOA and OOD"
- Previous message: James D Carroll: "comp.lang.uml ?"
- Next in thread: Michael Rauscher: "Re: J2EE DAO Pattern"
- Reply: Michael Rauscher: "Re: J2EE DAO Pattern"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|