Chapter 5 relational database confusion

I’m at chapter 5 and feel like nothing’s explained.

  1. CachedAnimalWithDetails is in a relationship with CachedVideo and CachedPhoto in an 1:N relationship. So we create CachedAnimalAggregate where we have one animal and a list of videos and photos. But CachedOrganization is also in a relationship with CachedAnimalWithDetails in 1:N yet we don’t create an aggregate class. Why?

  2. CachedVideo and CachedPhoto have a foreign key, CachedAnimalWithDetails.animalId. We annotate the class as such and the data class also has a property val animalId: Long. However, CachedAnimalWithDetails also has a foreign key, CachedOrganization.organizationId yet this time, we only annotate the class and the data class doesn’t have any organizationId property. Why?

  3. Page 97, there’s a code snippet of CachedAnimalAggregate and then the explanations:

In this code you used:

  1. @Embedded for the animal property of type CachedAnimalWithDetails
  2. @Relation for the photos and videos properties of type List and List respectively…

Are you folks serious? Not only did you not explain anything (why or what those annotations do), you literally described what I’ve already done. That’s like saying “you calculated 1 + 1 = 2 because one plus one is two”. It’s not only zero value information, it’s literally negative value information.