If you are thinking about using a single query and bypassing your DTO's then consider using the Data Transfer RowSet pattern; it can be a useful pattern for easily transferring data from a DAO to a view component. If it's disadvantages (clients need to know something about the database metadata, it ignores the domain model) are not relevant in your situation or if they can be minimised (allow its use for read only display or closely controlled use cases only) then it might work for you. BeanUtils provides a neat wrapper for the disconnected recordsets used in this pattern: org.apache.commons.beanutils.RowSetDynaClass.
-----Original Message----- From: Tom Ziemer [mailto:[EMAIL PROTECTED] Sent: 18 August 2005 13:01 To: Struts Users Mailing List Subject: [OT] Loading data for view Hi everybody! In my app, I am using DAOs/DTOs to perform CRUD operations on a legacy database packed with lots of triggers and stored procedures. Some of my DTOs are pretty complex, meaning, they have to be assembled from many tables. A simple example: Object a (loaded by aDAO) has a list of b objects (loaded by bDAO), which in turn has a list of c objects (loaded by cDAO) The problem: In my struts-based webapp, I want to display some a objects on a page (the objects won't be used after that anymore). I need a few attributes from related object b but nothing at all from the related c objects. When I use my aDAO to retrieve my a objects, this will cause a large number of sql queries (1 per object), resulting in lots of data I do not need. The question: Wouldn't it be more effecient to use a single query, that only loads the required data? This would mean though, that I cannot use my DTOs. Any thoughts? Regards, Tom --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -------------------------------------------------------- If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail. http://www.ml.com/email_terms/ -------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]