Пожалуйста, не отмечайте это как дубликат. Я видел другие похожие посты, но ничего не помогло
Моя сущность:
@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)
}
Я использовал room
и все, что я сделал, это добавил 4-ую функцию (getBatchName) в свой dao
, но я не уверен, почему эта ошибка начала возникать.
Ошибка во время компиляции:
error: Entities and POJOs must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type). - `kotlin.Unit`