I want to create a DAO Object with a custom function like this
@Dao
interface DataAccessObjDao{
@Insert
fun insert(someEntity: SomeEntity)
@Ignore
fun sampleFun(){
insert(SumEntity())
}
}
but compiler complains about sample fun
Class 'DataAccessObjDao_Impl' must either be declared abstract or implement abstract method 'sampleFun()' in 'DataAccessObjDao
@Ignore
is for property or entity, can not be used on a method.
You can do this by extending your interface :
fun DataAccessObjDao.sampleFun(){
// irrelevant code
}
or by adding @Transaction
@Transaction
fun sampleFun(){
firstDelete()
thenInsert()
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With