// 'select' the BusinessEntity's Contact objects
Vector contactList = ContactTable.select(businessKey,connection);
for (int contactID=0; contactID<contactList.size(); contactID++)
{
Contact contact = (Contact)contactList.elementAt(contactID);
contact.setPhoneVector(PhoneTable.select(businessKey,contactID,connection));
contact.setEmailVector(EmailTable.select(businessKey,contactID,connection));
Vector addressList = AddressTable.select(businessKey,contactID,connection);
for (int addressID=0; addressID<addressList.size(); addressID++)
{
Address address = (Address)addressList.elementAt(addressID);
address.setAddressLineVector(AddressLineTable.select(businessKey,contactID,addressID,connection));
}
contact.setAddressVector(addressList);
}
Contacts contacts = new Contacts();
contacts.setContactVector(contactList);
business.setContacts(contacts);