Android Kotlin Room错误:实体和POJO应具有构造函数
请不要将此标记为重复,我见过其他类似的帖子,但没有任何帮助 我的实体:Android Kotlin Room错误:实体和POJO应具有构造函数,android,kotlin,android-room,Android,Kotlin,Android Room,请不要将此标记为重复,我见过其他类似的帖子,但没有任何帮助 我的实体: @Entity(tableName = "batch_table") data class Batch( val batch_id: String? ="", val batch_name: String? ="", val user_m_id: String? ="", val user_profile_id: String? ="" ){ @PrimaryKey(autoGener
@Entity(tableName = "batch_table")
data class Batch(
val batch_id: String? ="",
val batch_name: String? ="",
val user_m_id: String? ="",
val user_profile_id: String? =""
){
@PrimaryKey(autoGenerate = true)
var id1: Int? = 0
constructor():this("","","","")
}
我的刀:
@Dao
interface BatchDao{
@Insert
suspend fun insert(batch : MutableList<Batch>)
@Query("delete from batch_table")
suspend fun deleteBatchTable()
@Query(" select * from batch_table ")
suspend fun getAllBatches() :List<Batch>
@Query("select batch_name from batch_table where batch_id = :batch_id")
suspend fun getBatchName(batch_id:String)
@Transaction
suspend fun insertBatches(batch: MutableList<Batch>){
deleteBatchTable()
insert(batch)
}
我忘了写函数的返回类型,但是抛出的错误指向了另一个东西,所以我感到困惑
@Query("select batch_name from batch_table where batch_id = :batch_id")
suspend fun getBatchName(batch_id:String) : String
@Query("select batch_name from batch_table where batch_id = :batch_id")
suspend fun getBatchName(batch_id:String) : String