You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Indices({@Index(value = "synced", type = IndexType.NonUnique)})
public class Receipt implements Parcelable {
@Id
public String clientRef;
public String dailySequence;
public double discount;
public double serviceCharge;
public String steward;
public ReceiptItem[] items;
public boolean synced;
// methods .....
}
And I save objects of this model to nitrite like below.
Infrequently, I get below exception when updating a receipt using above code. Note that I am upserting the receipt, and there is only a single unique key. So I am not expecting a unique constraint violation, even though the db already has a receipt with the same clientRef. If receipt already found, it should be updated because I specified to upsert.
Fatal Exception: org.dizitart.no2.exceptions.UniqueConstraintException: NO2.10003: unique key constraint violation for clientRef
at org.dizitart.no2.internals.IndexingService.updateIndexEntry(IndexingService.java:126)
at org.dizitart.no2.internals.DataService.insert(DataService.java:94)
at org.dizitart.no2.internals.DataService.update(DataService.java:134)
at org.dizitart.no2.internals.NitriteService.update(NitriteService.java:361)
at org.dizitart.no2.internals.DefaultNitriteCollection.update(DefaultNitriteCollection.java:322)
at org.dizitart.no2.objects.DefaultObjectRepository.update(DefaultObjectRepository.java:141)
at org.dizitart.no2.objects.DefaultObjectRepository.update(DefaultObjectRepository.java:126)
at com.lahiruchandima.pos.core.DatabaseHelper.persistReceipt(DatabaseHelper.java:483)
at com.lahiruchandima.pos.core.ReceiptCacher.lambda$null$5$ReceiptCacher(ReceiptCacher.java:109)
at com.lahiruchandima.pos.core.-$$Lambda$ReceiptCacher$FaO2Rq30Et4o2YAiQFhLGXUb3DI.run(lambda)
at java.lang.Thread.run(Thread.java:776)
Can this be a bug in nitrite? Is there any workaround for this?
The text was updated successfully, but these errors were encountered:
I have below data model.
And I save objects of this model to nitrite like below.
Infrequently, I get below exception when updating a receipt using above code. Note that I am upserting the receipt, and there is only a single unique key. So I am not expecting a unique constraint violation, even though the db already has a receipt with the same clientRef. If receipt already found, it should be updated because I specified to upsert.
Can this be a bug in nitrite? Is there any workaround for this?
The text was updated successfully, but these errors were encountered: