This is my first web application based on SOA and is user-specific. I have three layers;
- web
- service
- database
for eaxample, I have a table graph like this:
("<---" = foreign-key)
User<---Post<---PostTitle
Now my service need to allow web to load PostTitles directly so the user can see it. However, this action must by user-specific, which means Mike cannot load Sam's data.
Problem is: My [PostTitle] table only foreign key [Post] table, it doesn't have any direct information about which user each record belongs to, so I have to do table join. It's fine for this simple case, but if I have a long table chain, it will be very trival to join from the end to the begining.
I think the most obvious solution is to add a UserID column on each table, so that I don't need to do joining. However, I feel it is a kind of wasting database space.
I hope someone who have experienced this kind of system can give me a real world suggestion on my design. The suggestion can be on any layer, besides database.