When it comes to inserting data on a RoomDB, what is the best method to handle the conflict strategy? As i have tried.
@Insert(onConflict = @Insert(onConflict = OnConflictStrategy.REPLACE))
But it didn't work, as during conflict it sometimes duplicates and mess the auto increment on the plk values.
@Insert(onConflict = OnConflictStrategy.NONE)
But that sometimes does not replace, hence at sometimes I had to go back to use the first conflict strategy @Insert(onConflict = OnConflictStrategy.REPLACE)
The documentation is giving me two statements for the same function or library @Insert(onConflict = OnConflictStrategy.REPLACE)
When you whover your mouse on "REPLACE" it says "OnConflict strategy constant to replace the old data and continue the transaction" on OnConflictStrategy.REPLACE where on OnConflictStrategy.NONE you get "OnConflict strategy constant used by default when no other strategy is set. Using it prevents Room from generating ON CONFLICT clause. It may be useful when there is a need to use ON CONFLICT clause within a trigger. The runtime behavior is the same as when ABORT strategy is applied. The transaction is rolled back"
But when you navigate to the implemantation or library object. you get something like "OnConflict strategy constant to rollback the transaction." on OnConflictStrategy.REPLACE where on OnConflictStrategy.NONE you get "OnConflict strategy constant to replace the old data and continue the transaction."