Hi Mike,
We just released a catalog of commonly used patterns and strategies to the
developer community. We touch on this issue among others. ( For specific
discussion of this issue have a look at the View Helper pattern. There is a
sidebar titled Helpers about halfway down the page in the 'Solution' section
that includes the following:
So how does the Account object access the Business Services. Let
us examine two cases, one simple and the other more
sophisticated. In the more simple case, imagine that a
project is
taking a phased approach, phasing in EJB into the
Business Tier
over time. Assume at the moment that the database is
being
accessed via JDBC calls from the presentation tier. In
this case, the
Account object uses a Data Access Object (see Data
Access Object
pattern), hiding the underlying implementation details
of accessing
the database. The Data Access Object knows what SQL
queries are
necessary to retrieve the information. These details are
hidden from
the rest of the application, reducing coupling and
making each
component more modular and reusable. This case is
described in the
previous sequence diagram.
When the architecture becomes more sophisticated, and
EJB is
introduced in the Business Tier, then the Data Access
Object is
replaced with a Business Delegate (see Business Delegate
pattern),
typically written by the developers of the Business
Service. The
Delegate hides the implementation details of EJB lookup,
invocation, and exception handling from its client. It
might also
improve performance by providing caching services.
Again, the
object reduces coupling between tiers, improving the
reusability and
modularity of the various components. Regardless of the
specific
implementation of this object, its interface may remain
unchanged
during this transition. The following sequence diagram
describes
this scenario after the transition to the Business
Delegate)
The url is:
http://developer.java.sun.com/developer/restricted/patterns/ViewHelper.html
and requires JDC login.
Any feedback or general comments, positive or negative, on the pattern catalog
are much appreciated.
Hope this helps.
-dm
Michael McCallister wrote:
> What strategies or patterns do people use to manage persistence of business
> object data in a Struts application when there is no EJB layer and there is
> a desire to keep the business objects as independent of the web portion of
> the application as possible? Do you use the Struts DataSource and pass
> either it or a Connection as a parameter to bean methods that take
> responsibility for managing persistence? Do you follow the J2EE blueprint
> and create separate Data Access Objects to support persistence? Are you
> using an open-source framework to manage persistence? This seems like a
> common problem, but I haven't seen much talk about common solutions.
>
> Mike
--
Dan Malks Sun Java Center
Enterprise Java Architect 703.208.5794