Skip to content

net.zetetic.database.sqlcipher.SQLiteConstraintException thrown if @Upsert is used #23

@AleksandarIlic

Description

@AleksandarIlic

I have implemented the sqlcipher-android in this commit:
PrimalHQ/primal-android-app@4bc4482

If I run clean install build I'm getting:

net.zetetic.database.sqlcipher.SQLiteConstraintException: UNIQUE constraint failed: ProfileData.ownerId (code 1555)
	at net.zetetic.database.sqlcipher.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
	at net.zetetic.database.sqlcipher.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:815)
	at net.zetetic.database.sqlcipher.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:823)
	at net.zetetic.database.sqlcipher.SQLiteStatement.executeInsert(SQLiteStatement.java:113)
	at androidx.room.EntityInsertionAdapter.insert(EntityInsertionAdapter.kt:51)
	at androidx.room.EntityUpsertionAdapter.upsert(EntityUpsertionAdapter.kt:91)
	at net.primal.android.profile.db.ProfileDataDao_Impl.upsertAll(ProfileDataDao_Impl.java:165)
	.....

It turns out that @Upsert is the cause of the crash. If we replace it with @Insert(onConflict = OnConflictStrategy.REPLACE) everything works fine. PrimalHQ/primal-android-app@a46232a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions