ActiveAndroid
ActiveAndroid copied to clipboard
Column.ConflictAction.REPLACE still causes Foreign Key violation.
Following the example from this guide I have set up the following:
@Column(name = "remote_id", unique = true, onUniqueConflict = Column.ConflictAction.REPLACE)
private int remoteId;
My intentional behavior is for old objects to get overwritten / REPLACEd when updated versions come in from the server. Whenever I try to save a newer version, I get foreign key violation errors.
android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787)
at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
+1
Have you found a fix or workaround for this?
what is with this bug? :)
warkaround: User user = new Select().from(User.class).where("userId = ?", userIdYouWantToRetrieve).executeSingle(); if (user != null){ user.setVerified(true); } else { user = new User(){//populate your new user here from json } } user.save();