Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Data Layer design

0 views
Skip to first unread message

arun2...@yahoo.com

unread,
Jan 3, 2005, 11:57:07 PM1/3/05
to
Hi,
I would like your opinion on wether to use the DAO pattern or command
pattern for the datalayer. This is for a citizen service application
which has features like water bill collection, phone bill collection,
isuuing trade, factory license and a host of other similar services.

The DAO pattern would contain classes like LixenseDAO, ApplicantDAO
etc. along the lines of the DAO pattern mentioned in the Core J2EE
pattern book.

(I am using Hibernate as the O/R mapping tool.)

The other alternative I am considering is based on the GoF Command
pattern,

Here I will have Command interface with a method named execute. This
will be implemented by classes like FindCommand, UpdateCommand,
InsertCommand etc. I will be using reflection to copy values to the
Database.

Which one would you reccomend?.

The performance requirement for this application is 4 transactions per
second.


thanks,

Arun

EventHelix.com

unread,
Jan 5, 2005, 6:10:48 AM1/5/05
to
You might also want to consider the following patten:

http://www.eventhelix.com/RealtimeMantra/PatternCatalog/protocol_layer.htm

Deepa
--
http://www.EventHelix.com/EventStudio
EventStudio 2.5 - Automate sequence diagram generation

kirkk

unread,
Jan 5, 2005, 10:40:11 AM1/5/05
to
DAO and command aren't necessarily mutually exclusive. A DAO just
encapsulates a database request, and you can pretty easily make your
DAO classes commands.

When using a tool like Hibernate, your DAO encapsulates the call to
Hibernate.

In your case, you can define a command interface for each of your DAO
(LixenseDAO, ApplicantDAO, etc.). Then provide a concrete
implementation of each that wrap the call to Hibernate. Make sure
nothing references the concrete class except a factory or a higher
level class that injects the concrete implementation into whatever
invokes the DAO. This way, you can create Test concrete implementations
of each of these DAO classes to decouple your test cases from the the
database.

Kirk Knoernschild
www.kirkk.com
www.extensiblejava.com

0 new messages