Yep. For a quick code example:
Iterator it = // get a list of employees that match some criteria while (it.hasNext()) { /* * Each EmployeeVO only contains its primary data */ EmployeeVO vo = (EmployeeVO) it.next(); /* * EmployeeVO lazily loads Department (only primary data) */ DepartmentVO deptVO = vo.getDepartment(); /* * Department lazily loads fooBarList */ Collection foobars = deptVO.getFooBarList(); } robert > -----Original Message----- > From: Rick Reumann [mailto:[EMAIL PROTECTED] > Sent: Monday, March 29, 2004 1:33 PM > To: Struts Users Mailing List > Subject: Re: [OT] RE: best practice question for certain VO/DTO fields? > > > On Mon, Mar 29, 2004 at 01:18:12PM -0500, Robert Taylor wrote: > > > couldn't you use a lazy loading scheme such that the > > Department reference in each Customer is not "loaded" until > > accessed and even when the Department is "loaded" only the > > primary Department data is loaded (no object references). > > So in essence, you only get what you need, when you need it. > > That sounds like a pretty good approach (although I admit I > haven't worked with lazy loading to that extent). So in > other words with the beans below: > > DepartmentVO > ------------ > Integer id; > String name; > List fooBarList; //of some kind of other heavy objects > List fooBar2List; //of some kind of other heavy objects > > EmployeeVO > ---------- > Integer id; > String name; > DepartmentVO dept; > > Now you are saying when displaying the list of Employees > only the id and name of the DepartmentVO might be loaded in > each Department, but if later I needed fooBarList a call to > that would then load up the List for me. > > I like that approach. > > -- > Rick > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]