The Android Developer Challenge is back! Submit your idea before December 2.

OnConflictStrategy

class OnConflictStrategy
androidx.room.OnConflictStrategy

Set of conflict handling strategies for various Dao methods.

Summary

Constants

static Int

OnConflict strategy constant to abort the transaction.

static Int

OnConflict strategy constant to fail the transaction.

static Int

OnConflict strategy constant to ignore the conflict.

static Int

OnConflict strategy constant to replace the old data and continue the transaction.

static Int

OnConflict strategy constant to rollback the transaction.

Public constructors

Set of conflict handling strategies for various Dao methods.

Constants

ABORT

static val ABORT: Int

OnConflict strategy constant to abort the transaction. The transaction is rolled back.

Value: 3

FAIL

static val FAIL: Int

Deprecated: Does not work as expected. The transaction is rolled back. Use ABORT.

OnConflict strategy constant to fail the transaction.

Value: 4

IGNORE

static val IGNORE: Int

OnConflict strategy constant to ignore the conflict.

An Insert DAO method that returns the inserted rows ids will return -1 for rows that are not inserted since this strategy will ignore the row if there is a conflict.

Value: 5

REPLACE

static val REPLACE: Int

OnConflict strategy constant to replace the old data and continue the transaction.

An Insert DAO method that returns the inserted rows ids will never return -1 since this strategy will always insert a row even if there is a conflict.

Value: 1

ROLLBACK

static val ROLLBACK: Int

Deprecated: Does not work with Android's current SQLite bindings. Use ABORT to roll back the transaction.

OnConflict strategy constant to rollback the transaction.

Value: 2

Public constructors

<init>

OnConflictStrategy()

Set of conflict handling strategies for various Dao methods.