插入后会议室数据库为空

时间:2020-03-26 05:20:11

标签: android android-studio android-room

插入新数据后,房间数据库仍然为空。

@Insert(onConflict = REPLACE)
fun insert(note: Note): Long

每次插入时都会返回ID,并且ID会递增,但是用SQL查看器查看时我看不到任何表或记录

数据库

db = Room.databaseBuilder(
                        context.applicationContext,
                        LocalDb::class.java, "LocalDb"
                    )
                        .build()

注意

@Entity(indices = [Index(value = ["text"], unique = true)])
class Note(
    var modifiedTime: Long = System.currentTimeMillis(),
    var text: String = "",
    var isLocked: Boolean = false,
    @Ignore
    var reminder: Reminder = Reminder(),
    var saved: Boolean = false,
    @Ignore
    @get:Exclude var drawing: MutableSet<Media> = mutableSetOf(),
    @Ignore
    @get:Exclude var media: MutableSet<Media> = mutableSetOf(),
    @PrimaryKey(autoGenerate = true)
    var rowid: Int = 0
) : ItemBase(NOTE)

0 个答案:

没有答案