Stay organized with collections
Save and categorize content based on your preferences.
OnConflictStrategy
public
abstract
@interface
OnConflictStrategy
implements
Annotation
android.arch.persistence.room.OnConflictStrategy
|
Set of conflict handling strategies for various Dao
methods.
Check SQLite conflict documentation for
details.
Summary
Constants |
int |
ABORT
OnConflict strategy constant to abort the transaction.
|
int |
FAIL
OnConflict strategy constant to fail the transaction.
|
int |
IGNORE
OnConflict strategy constant to ignore the conflict.
|
int |
REPLACE
OnConflict strategy constant to replace the old data and continue the transaction.
|
int |
ROLLBACK
OnConflict strategy constant to rollback the transaction.
|
Inherited methods |
From interface
java.lang.annotation.Annotation
abstract
Class<? extends Annotation>
|
annotationType()
|
abstract
boolean
|
equals(Object arg0)
|
abstract
int
|
hashCode()
|
abstract
String
|
toString()
|
|
Constants
ABORT
int ABORT
OnConflict strategy constant to abort the transaction.
Constant Value:
3
(0x00000003)
FAIL
int FAIL
OnConflict strategy constant to fail the transaction.
Constant Value:
4
(0x00000004)
IGNORE
int IGNORE
OnConflict strategy constant to ignore the conflict.
Constant Value:
5
(0x00000005)
REPLACE
int REPLACE
OnConflict strategy constant to replace the old data and continue the transaction.
Constant Value:
1
(0x00000001)
ROLLBACK
int ROLLBACK
OnConflict strategy constant to rollback the transaction.
Constant Value:
2
(0x00000002)
Annotations
Classes
Enums
Exceptions
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# OnConflictStrategy\n\nSummary: [Constants](#constants) \\| [Inherited Methods](#inhmethods) \n\nOnConflictStrategy\n==================\n\n| The `android.arch` Architecture Components packages are no longer maintained. They have been superseded by the corresponding [androidx.\\*](/jetpack/androidx/migrate) packages. See [androidx.room.OnConflictStrategy](/reference/androidx/room/OnConflictStrategy) instead.\n\n\n`\npublic\n\n\nabstract\n@interface\nOnConflictStrategy\n`\n\n\n`\n\n\nimplements\n\nAnnotation\n\n\n`\n\n|--------------------------------------------------|\n| android.arch.persistence.room.OnConflictStrategy |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nSet of conflict handling strategies for various [Dao](/reference/android/arch/persistence/room/Dao) methods.\n\n\nCheck [SQLite conflict documentation](https://sqlite.org/lang_conflict.html) for\ndetails.\n\nSummary\n-------\n\n| ### Constants ||\n|-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `int` | [ABORT](/reference/android/arch/persistence/room/OnConflictStrategy#ABORT) OnConflict strategy constant to abort the transaction. |\n| `int` | [FAIL](/reference/android/arch/persistence/room/OnConflictStrategy#FAIL) OnConflict strategy constant to fail the transaction. |\n| `int` | [IGNORE](/reference/android/arch/persistence/room/OnConflictStrategy#IGNORE) OnConflict strategy constant to ignore the conflict. |\n| `int` | [REPLACE](/reference/android/arch/persistence/room/OnConflictStrategy#REPLACE) OnConflict strategy constant to replace the old data and continue the transaction. |\n| `int` | [ROLLBACK](/reference/android/arch/persistence/room/OnConflictStrategy#ROLLBACK) OnConflict strategy constant to rollback the transaction. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` java.lang.annotation.Annotation ` |-----------------------------------------|-------------------------| | ` abstract Class\u003c? extends Annotation\u003e` | ` annotationType() ` | | ` abstract boolean` | ` equals(Object arg0) ` | | ` abstract int` | ` hashCode() ` | | ` abstract String` | ` toString() ` | ||\n\nConstants\n---------\n\n### ABORT\n\n```\nint ABORT\n```\n\nOnConflict strategy constant to abort the transaction.\n\n\u003cbr /\u003e\n\nConstant Value:\n\n3\n(0x00000003)\n\n\n### FAIL\n\n```\nint FAIL\n```\n\nOnConflict strategy constant to fail the transaction.\n\n\u003cbr /\u003e\n\nConstant Value:\n\n4\n(0x00000004)\n\n\n### IGNORE\n\n```\nint IGNORE\n```\n\nOnConflict strategy constant to ignore the conflict.\n\n\u003cbr /\u003e\n\nConstant Value:\n\n5\n(0x00000005)\n\n\n### REPLACE\n\n```\nint REPLACE\n```\n\nOnConflict strategy constant to replace the old data and continue the transaction.\n\n\u003cbr /\u003e\n\nConstant Value:\n\n1\n(0x00000001)\n\n\n### ROLLBACK\n\n```\nint ROLLBACK\n```\n\nOnConflict strategy constant to rollback the transaction.\n\n\u003cbr /\u003e\n\nConstant Value:\n\n2\n(0x00000002)\n\n\n-\n\n Annotations\n -----------\n\n - [ColumnInfo](/reference/android/arch/persistence/room/ColumnInfo)\n - [ColumnInfo.Collate](/reference/android/arch/persistence/room/ColumnInfo.Collate)\n - [ColumnInfo.SQLiteTypeAffinity](/reference/android/arch/persistence/room/ColumnInfo.SQLiteTypeAffinity)\n - [Dao](/reference/android/arch/persistence/room/Dao)\n - [Database](/reference/android/arch/persistence/room/Database)\n - [Delete](/reference/android/arch/persistence/room/Delete)\n - [Embedded](/reference/android/arch/persistence/room/Embedded)\n - [Entity](/reference/android/arch/persistence/room/Entity)\n - [ForeignKey](/reference/android/arch/persistence/room/ForeignKey)\n - [ForeignKey.Action](/reference/android/arch/persistence/room/ForeignKey.Action)\n - [Ignore](/reference/android/arch/persistence/room/Ignore)\n - [Index](/reference/android/arch/persistence/room)\n - [Insert](/reference/android/arch/persistence/room/Insert)\n - [OnConflictStrategy](/reference/android/arch/persistence/room/OnConflictStrategy)\n - [PrimaryKey](/reference/android/arch/persistence/room/PrimaryKey)\n - [Query](/reference/android/arch/persistence/room/Query)\n - [RawQuery](/reference/android/arch/persistence/room/RawQuery)\n - [Relation](/reference/android/arch/persistence/room/Relation)\n - [SkipQueryVerification](/reference/android/arch/persistence/room/SkipQueryVerification)\n - [Transaction](/reference/android/arch/persistence/room/Transaction)\n - [TypeConverter](/reference/android/arch/persistence/room/TypeConverter)\n - [TypeConverters](/reference/android/arch/persistence/room/TypeConverters)\n - [Update](/reference/android/arch/persistence/room/Update)\n-\n\n Classes\n -------\n\n - [DatabaseConfiguration](/reference/android/arch/persistence/room/DatabaseConfiguration)\n - [InvalidationTracker](/reference/android/arch/persistence/room/InvalidationTracker)\n - [InvalidationTracker.Observer](/reference/android/arch/persistence/room/InvalidationTracker.Observer)\n - [Room](/reference/android/arch/persistence/room/Room)\n - [RoomDatabase](/reference/android/arch/persistence/room/RoomDatabase)\n - [RoomDatabase.Builder](/reference/android/arch/persistence/room/RoomDatabase.Builder)\n - [RoomDatabase.Callback](/reference/android/arch/persistence/room/RoomDatabase.Callback)\n - [RoomDatabase.MigrationContainer](/reference/android/arch/persistence/room/RoomDatabase.MigrationContainer)\n - [RoomWarnings](/reference/android/arch/persistence/room/RoomWarnings)\n - [RxRoom](/reference/android/arch/persistence/room/RxRoom)\n-\n\n Enums\n -----\n\n - [RoomDatabase.JournalMode](/reference/android/arch/persistence/room/RoomDatabase.JournalMode)\n-\n\n Exceptions\n ----------\n\n - [EmptyResultSetException](/reference/android/arch/persistence/room/EmptyResultSetException)"]]