Return-Path: Delivered-To: apmail-jakarta-struts-user-archive@apache.org Received: (qmail 36058 invoked from network); 2 Dec 2001 22:46:10 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 2 Dec 2001 22:46:10 -0000 Received: (qmail 29517 invoked by uid 97); 2 Dec 2001 22:46:05 -0000 Delivered-To: qmlist-jakarta-archive-struts-user@jakarta.apache.org Received: (qmail 29501 invoked by uid 97); 2 Dec 2001 22:46:04 -0000 Mailing-List: contact struts-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list struts-user@jakarta.apache.org Received: (qmail 29479 invoked from network); 2 Dec 2001 22:46:03 -0000 Date: Sun, 02 Dec 2001 17:45:59 -0500 From: AbmyersA@netscape.net (Andrew Myers) To: struts-user@jakarta.apache.org Subject: Design of Business Objects Message-ID: <4FCC803B.72E97840.006B72CC@netscape.net> X-Mailer: Atlas Mailer 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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: For additional commands, e-mail: