ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric T. Blue" <ericblu...@gmail.com>
Subject Re: Just curious - How cloesly do your value objects back the data model?
Date Thu, 04 May 2006 19:00:49 GMT
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 <rickcr@gmail.com> 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
>

Mime
View raw message