Room Database
Android's SQLite layer, with compile-checked DAOs, annotated entities, relations and versioned migrations. Asked because local persistence is where offline behavior and upgrades work or corrupt data.
on this pageshowhide
explore
- Entities and Schema6 questions
- DAOs and Queries5 questions
- Relations and Embedded6 questions
- Type Converters5 questions
- Migrations and Schema6 questions
- Coroutines and Flow5 questions
questions
page 2 of 2As the Android lead on a Room app, what schema-change policy would you set for exported schemas, auto versus hand-written migrations, and destructive fallback in release builds?
basics
~10 sCommit exported schemas and review their diffs, require a tested path from every version still installed, auto-migrate additive changes, hand-write data moves, and keep a blanket fallbackToDestructiveMigration out of release builds.
As a team default for Room entities, when should a list such as an event's attendee ids be a converter-backed JSON column rather than its own table?
basics
~20 sUse a converter-backed JSON column only for small, bounded values read and written whole and never queried by element. Anything queried, referenced or growing belongs in a table, where Room's indexes, foreign keys, relations and exported schema still apply.
In Room 3.0, how does @Relation join a child entity to a parent with a composite key, and what did Room 2.x apps do instead?
basics
~20 sRoom 3.0 lists every key column in @Relation's parentColumns and entityColumns arrays, paired by position, and Junction takes arrays too. Room 2.x accepted one column per side, so apps used a single surrogate key or a hand-written JOIN.
showing 31–33 of 33