I have an @Entity which holds a variable(list of custom object) along with other fields for the table. I am able to insert, fetch and delete from this entity.
But I am facing an issue in updating the entity:
I want to update that particular field which holds a list of custom object in the table but while compilation it throws an error:
error: Query method parameters should either be a type that can be converted into a
database column or a List / Array that contains such type. You can consider adding a Type Adapter for this.
I could update the complete row object but the problem lies in updating this single field. I am using TypeConverters on my @Database class but I have tried using them on Dao and the update function itself but it reports the same error.
Can someone please help me to update this particular field in the row, I don't want to provide the full object of this entity for this to happen.
My Entity is:
@Entity data class TableName(
@PrimaryKey
var id: String = "",
@SerializedName("varOne")
@Expose
var varOne: List<CustomObjects>? = null)
Update method is something like this:
@TypeConverters(MyTypeConverters.VarOneListTypeConverters::class)
@Query("Update TableName SET varOne = :varOneList")
abstract fun updateTableName(varOneList: List<CustomObjects>)
VarOneListTypeConverters
code? – Hysterectomize