You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matt Raible <ma...@raibledesigns.com> on 2001/11/30 04:42:43 UTC

Any Struts Reference Apps that implement DAO?

I'd like to implement the DAO pattern in a struts application I'm building -
is anyone using this - if so, would you recommend?

Also, what's the advantages/disadvantages for declaring your database
parameters in struts-config.xml vs. web.xml?

Thanks,

Matt

Re: Any Struts Reference Apps that implement DAO?

Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "Matt" == Matt Raible <ma...@raibledesigns.com> writes:

    Matt> I'd like to implement the DAO pattern in a struts application I'm building -
    Matt> is anyone using this - if so, would you recommend?

    Matt> Also, what's the advantages/disadvantages for declaring your database
    Matt> parameters in struts-config.xml vs. web.xml?

Using the DAO pattern is not as complex as you might think.  It simply means
that you're abstracting the persistence layer, so the real persistence layer
can use either EJBs or some other implementation.

In a Struts application, you would most likely see DAO classes (only) being
used in the Action classes.  If you presently have an EJB application, consider
an almost one-to-one mapping between your EJB "entities" (not Entity Beans, but
higher-level) and each DAO class.

Using the DAO pattern, your web application doesn't need to know about EJB.

The DAO classes essentially act as a bridge between the web layer and the
persistence layer.  If you catch EJB exceptions in the DAO class, and you need
to pass them to the caller, then create web exceptions (Servlet or JSP), but
you could still consider logging the EJB-related exceptions.

-- 
===================================================================
David M. Karr          ; Best Consulting
dmkarr@earthlink.net   ; Java/Unix/XML/C++/X ; BrainBench CJ12P (#12004)


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>