That is correct, assuming that you are dealing with one User object that is 
compositing an Address object. Sean already explained using a gateway to 
bring back multiple of users and their addresses together.

Assumign one User object, you could run one query to get the address for the 
single User, populate the Address object with that data, and then all of 
your method calls would just be reading the instance data from the Address 
object. There shouldn't need to be any additional queries for address 
information.

On 6/1/05, Johnny Le <[EMAIL PROTECTED]> wrote:
> 
> So even when I use user.getAddress().getCity(), user.getAddress().getState(), 
> user.getAddress().getZip(), I didn't make three separate calls to the 
> database, just one? That's great.
> 
> 
> >The answer to your second question about the address is to use 
> composition
> >and have the User object hold a reference to an Address object. So you 
> are
> >on track there. But you don't have to execute a query when you call
> >getAddress(), the Address object is already there and populated (at the 
> same
> >time the User object is created) so you're just getting the state of the
> >Address object by calling methods on it. Basically you don't need to run 
> any
> >queries beyond the first one that you use when you initialize the Address
> >object.
> >
> >Hope that helps.
> >
> >Brian
> >
> >
> >
> >On 6/1/05, Johnny Le <[EMAIL PROTECTED]> wrote:
> >>
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208232
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to