Hi,

This is not exactly a question related to Struts as such but it does relate to a 
Struts application I'm building. :)

I have a search function that allows users to search for a Property via a street 
address.  The business objects I have to support this are a "Property" object and a 
"PropertySearch" object.  From my action class I call a method on the PropertySearch 
object which then will ultimately return an array of Property objects corresponding to 
those which match the search criteria.

My question is this:

Which object should take responsibility for the population of the Property objects 
with data from the database?  It seems much better from an OO viewpoint to be able to 
pass the primary key into the constructor of the Property object and then call a 
helper method to populate the object.  But this is inefficient if the search returns a 
large number of results.  Eg. for 100 results there's 101 database hits (1 to get all 
the matching primary keys, and then 100 to populate each of the objects in turn).  The 
other alternative is to have my initial query return all the data and then have a 
constructor on the Property object which takes about 25 parameters (ugly and perhaps 
not very reusable, but more efficient?)

Does anyone have any thoughts on what the best practice is here?

Thanks,
Andrew.
-- 




__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the 
convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to