Typically, you would/should not expose properties that are used in deriving a database relationship.  These type of id properties are called surrogate keys and do not have any real business meaning.  I'd recommend modeling your objects as Employee -> Company, and let SQL do your joins on the id columns/properties.

On 5/4/06, Rick Reumann <[EMAIL PROTECTED]> wrote:
I'm often torn when developing web applications how Object Oriented I
should build my value objects. For examle...

You might have an Employee table...

employeeId
employeeName
companyId
//..

Do you guys typically have your Employee value object hold "Integer
companyId" or instead populate the companyId in a Company object as a
property of Employee...

class Employee {
   Integer employeeId;
   Company company; //instead of Integer companyId

I typically take the above approach (using Company) but  there are
times when I don't always follow this practice.

--
Rick

Reply via email to