Dane wrote:
The contacts table exists for normalization purposes. I'd like to design the entity model and forget about how things are normalized. With the latter approach I have to remember that the contact and employee are separate when logically they are not. The first way didn't work when I tried it but I could be doing somthing wrong. Just wanted to see if this works in theory.
Just my opinion here, but . . .
If contact information is inherently part of the employee, there is no reason to have it in a separate table. If it seems natural to you to access the contact information directly, but you are having to fetch it from another table, it's likely that your model does not correctly represent your design.
If you have exactly one contact for every employee, and if that contact info won't be used for anything else, then it probably belongs in the employee table. Pulling the contact info into another table does not make your model more normalized--in fact is can add complexity where none is required (it will also degrade performance, but probably not much in the case you described).
Take this with a grain of salt, of course, since I'm sure there is much more to what you are doing than what you posted. But I've seen cases where developers get too enthusiastic about "normalization", and misapply it to mean abstracting out entities that share common fields, which is not the point of normalization at all.
(If you're committed to having contacts in a separate table, you might look at adding your own code to the entity to accomplish this transparency. )
Phil