door icon indicating copy to clipboard operation
door copied to clipboard

@Entity name must match class name

Open gonemad opened this issue 1 year ago • 0 comments

When creating tables.. the tableName needs to match the class name or it will throw a runtime error when you try to insert into the database. The database does get created fine from what i saw, but inserts fail

Works:

@Entity(tableName = "ChannelEntity")
data class ChannelEntity(var name: String = ""

Doesnt work

@Entity(tableName = "channel")
data class ChannelEntity(var name: String = ""

I dont have the exact exception.. but it was in an InvalidationTracker and it was complaining about a table not being found (it listed the name of the class instead of the name i gave the table)

Support for tableName = "something other than class name" would be appreciated as that is supported in Room

gonemad avatar Jan 19 '24 22:01 gonemad