Rollback
@Insert(onConflict = OnConflictStrategy.ROLLBACK)
@Update(onConflict = OnConflictStrategy.ROLLBACK)
What SQLite Does
This strategy maps to INSERT OR ROLLBACK
or UPDATE OR ROLLBACK
statements.
It rolls back the transaction, as you might expect given the name.
Effects in Room
Frankly, it does not work very well. The Room-generated code does not expect the transaction to be rolled back, and so its call to endTransaction()
fails with an obscure SQLiteException
.
Since ABORT
and FAIL
also have the net effect in Room of rolling back the transaction, they are better choices.
Prev Table of Contents Next
This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.