I'm thinking about a design issue which affects my project's data base. Supposing there are three diferent tables:
- CLIENT
- ORDER
- PACKING_SLIP
Each order has its client and different packing slips. So there are some foreign keys which are compulsory, there would be clientId for the ORDER
and orderId for the PACKING_SLIP
table. That makes full sense.
Now suppose in my logic I want to have access to the client from the packing slip. As I'm using an ORM tool as Hibernate, that involves firstly accessing the order from the packing slip and after getting the client from it.
If I want to have access to the client directly, I should add the clientId foreign key also to the PACKING SLIP
table.
My question is, is that a correct design if there's a possibility to get the client joining the ORDER
table? Isn't it a bit redundant? I think it's a control problem and the data base part shouldn't take care about it...