Defining and Using Relationships
So far we have modeled Forum, Topic, and Post without any of the links that tie them together. Each Post has a Topic, a Topic has several Posts, and a Forum has a list of Topics.
These “links” are commonly known as relationships.
Introduction to To-One Relationships
When we say that a Post has a Topic we mean more formally that each Post object has, or is related to, one Topic object. The way that this is modeled at the object level is as attributes of type Enterprise Object.
On the other hand, the way the database keeps track of relations is by using a pointer. Post#1 is related to Topic#1, Post#2 is related to Topic#2, Post#3 is related to Topic#1, and so on.
So the POST table will have a column TOPIC_ID, which ...
Get WebObjects® Developer's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.