I have a heavily normalized DB (55 tables) which means that I have to do
some serious joining to get any data.  I have been tempted to almost
recreate the relationships that exist in the DB within my VOs and
ActionForms.  Make a VO for every single table, and just nest them as they
exist in the DB.  I have been needing to do this because I need several
fields of data from a particular entity.

For instance, say I have the following tables:

SCHOOL
ID
Name
PrincipalID (FK to Person)

PERSON
ID
First_Name
Last_Name
TypeID

PERSON_TYPE
ID
Type


To get info about a school, I would populate a school object in my DAO:

SchoolVO {
private int ID;
private String name;
private Person principal;
}

using tables:

Person{
private int ID;
private String firstName;
private String lastName;
private PersonType personType;
}

PersonType {
private int ID;
private String type;
}


Is it better to just shove everything into the SchoolVO and get rid of any
kind of resemblance to the relations that exist in the DB?

So instead, do:

SchoolVO {
private int IID;
private String name;
private int principalID;
private String principalFirstName;
private String principalLastName;
private String personType;
}

I don't like this approach as it gets out of hand when I have Lists of
other objects or lists within lists.

Having multiple layers of nesting of objects, is no walk in the park either
(especially when it comes to iterating through it all on JSP pages), but at
least it makes more sense to me because it mimics the DB so closely.

Any ideas for best practicies when you have a DB that is so normalized?  

Thanks,
Trevor

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to