Stack Exchange
Android Room Observer: Relational data update not displayed correctly
I am having a relational data structure like the following
Entry.kt
@Entity(tableName = "entries")
data class Entry(
    @ColumnInfo(name = "entry_id") @PrimaryKey(autoGenerate = true) val entryID: Long,
    @ColumnInfo(name = "time_stamp") val timeStamp: Timestamp
)

Feeling.kt
@Entity(tableName = "feelings")
data class Feeling(
    @ColumnInfo(name = "feeling_id") @PrimaryKey(autoGenerate = true) val feelingID: Int,
    val feeling: String,
    val color: Int
)

Subentry.kt
@Entity(tableName = "sub_entries",indices = [Index("feeling_id")])
data class SubEntry(
    @ColumnInfo(name = "sub_entry_id") @PrimaryKey(autoGenerate = true) val subEntryID: Long,
    @ColumnInfo(name = "entry_id") var entryID: Long,
    @ColumnInfo(name = "feeling_id") val feelingID: Int,
    val intensity: Int
)

as well as a DOJO linking the three
EntryWithSubEntriesAndFeelings.kt
data class EntryWithSubEntriesAndFeelings(
    @Embedded val entry: Entry,
    @Relation(
        parentColumn = "entry_id",
        entityColumn = "entry_id"
    )
    val subEntries: List<SubEntry>,
    @Relation(
        parentColumn = "entry_id",
        entityColumn = "feeling_id",
        associateBy = Junction(SubEntry::class)
    )
    val feelings: List<Feeling>
)

Now with a prepopulated feelings database, everything works fine. But I am currently adding the feature to insert custom feelings. Those and the corresponding subentries end up correctly in the subentry database (I copied the database files from the virtual device and checked them manually). But for some reason, the new feeling is not getting passed to the observer and the adapter and thus it is not being displayed together with the other subentries.
Any hints are appreciated! :)

Turns out I still had some hardcoded references to the initial list in my code which prevented the new feeling from being displayed.
