android_catalogue1-2 Exercise 1: The Five Data Files ===================================================== Files in com.example.catalogue.data and what each import is for: ItemType.kt androidx.room.Entity marks the class as a table androidx.room.Index declares the unique index on name androidx.room.PrimaryKey marks id as the key Tag.kt the same three, plus androidx.room.ColumnInfo (case-insensitive collation on name) Item.kt Entity, Index, PrimaryKey, plus androidx.room.ForeignKey (link to item_type) ItemTagCrossRef.kt Entity, Index, ForeignKey (no PrimaryKey import: the key is the primaryKeys argument) ItemWithDetails.kt androidx.room.Embedded, Relation, Junction (not an entity: no table is created) Checking: Room is only added to Gradle in Chapter 3. Until then, annotations show as unresolved (red). Once the Room runtime, ktx and compiler dependencies are added and Gradle is synced, the red goes away and Build > Make Project will report any real error in an annotation (for example a misspelled column name). Common problems: - Package line missing or different from the folder: Kotlin does not require them to match, but keep them equal. - ItemWithDetails given @Entity by mistake: it is a read model, not a table.