struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Graham" <>
Subject Re: [Best Practices] Use of Map as ValueObject
Date Thu, 31 Oct 2002 21:46:38 GMT
Never pass the ResultSet out of the DAO.  This holds the db connection 
longer than is necessary as well as exposing the DAO implementation to the 
business logic (which defeats the whole purpose of the dao).  The dao passes 
a value bean back to the business logic.

I wouldn't use maps either because then your system becomes hard to maintain 
with questions like, "What does this Map represent?" and "What values do I 
have access to in this Map?".  Using value beans makes your system 
symantically clear.


>From: "Jerry Jalenak" <>
>Reply-To: "Struts Users Mailing List" <>
>To: "''" <>
>Subject: [Best Practices] Use of Map as ValueObject
>Date: Thu, 31 Oct 2002 15:12:22 -0600
>During a conversation with one of my programmers today, I mentioned that I
>had begun using Maps instead of a ValueObject bean to pass basic data
>elements between my Action, Business Logic, and DAO levels.  Coming back up
>from a DAO I've tended to pass the ResultSet (or void) back to my Business
>Logic.  In my Business Logic I instantiate a bean, populate it with the 
>from the ResultSet, and pass it back to my Action.  The Action can then
>store it in the request/session (as needed), and then forward to the
>appropriate JSP.  I was asked what the advantages were to this approach, 
>aside from not having to write ValueObject beans, I can't come up with a
>good answer.  My question to the list then is this - Is this an appropriate
>approach to passing simple data elements between application layers?  Is it
>better to write ValueObject beans?  If so, why?
>I'm open to comments on this, as we are trying to standardize on how we 
>data around....
>Jerry Jalenak
>Web Publishing
>LabOne, Inc.
>10101 Renner Blvd.
>Lenexa, KS  66219
>(913) 577-1496
>This transmission (and any information attached to it) may be confidential 
>and is intended solely for the use of the individual or entity to which it 
>is addressed. If you are not the intended recipient or the person 
>responsible for delivering the transmission to the intended recipient, be 
>advised that you have received this transmission in error and that any use, 
>dissemination, forwarding, printing, or copying of this information is 
>strictly prohibited. If you have received this transmission in error, 
>please immediately notify LabOne at (800)388-4675.
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 

Surf the Web without missing calls! Get MSN Broadband.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message