Closed wngu6 closed 1 year ago
The tableName
should be "Item" not "Items" following the note from the previous codelab:
Note: Like with Kotlin classes, the convention is to use the singular form for the name of database tables. For the example above, that means you name the tables teacher, student, and course, not the plural forms of teachers, students, and courses.
Note: Like with Kotlin classes, the convention is to use the singular form for the name of database tables.
Тогда переименуйте таблицу в 5. Create an item Entity !
Сейчас так: @Entity(tableName = "items") data class Item( ... )
Странно, конечно, использовать единственное число для сущности, содержащей много предметов. Раз уж приняли правило, так применяйте везде. В текущем виде пример не работоспособен.
Course containing the note about table naming convention mentioned by @PICO443 above. https://developer.android.com/codelabs/basic-android-kotlin-compose-sql#1
Inconsistent naming of database tables can be found in Android Room guide too. For the definition of entities it uses a plural word for table name, while the example shows singular naming in a query for accessing the data.
Hello @wngu6,
Thank you for reaching out to us. It is fixed and published.
URL of codelab:
Specify the language of the codelab if it is not English:
In which task and step of the codelab can this issue be found?
Describe the problem The
tableName
in@Entity(tableName = "items")
should be@Entity(tableName = "item")
, otherwise the following error will occur during build:Steps to reproduce?
Versions Android Studio version: API version of the emulator:
Additional information Include screenshots if they would be useful in clarifying the problem.