Well, I lost the argument for populating all the Objects, thus incurring only one roundtrip to the db. We decided to conserve memory, since each user will, in fact, have a customized list of Objects at their disposal, and this may lead to some memory overload (I guess, but I still don't think it is significant). Instead of populating a List of Objects, we populate one Object, and have a List of "scaled-down" Objects (with only a few key attributes for lookup in the db). When the user chooses to examine another Object, we look up the scaled-down Object attribute, send the query to the db, and retrieve the complete Object and dump it in the Session. In a nutshell, look at this
pattern:
So, the Employee class represents the complete model of an Employee from the database. The EmployeeIndex represents only the info we need to lookup an Employee in the database (I'm not sure there should even be an inheritance relationship here). Essentially, a List of EmployeeIndex objects will be displayed on the
jsp page and, in response to a click, the respective Employee object will be retrieved from the database.
So, it seems to me, the only savings we have is that the EmployeeIndex class does not have all the additional attributes of a full-blown Employee, and thus has a smaller footprint in memory. What do you guys think?
Thanks!