MinFu MinFu - 3 months ago 36
Android Question

insert or update in realm cause duplication

I'm new to realm android and I'm try to perform

operation but I found out that the record is duplicated. after that I tried to to set primary key to my model which I use url(string and not autoincrement) as my primar key it cause all the insertion failed. how to set a unique key to my url so that insertOr Update works


I solved my problem in order to make bgRealm.insertOrUpdate(write_feed); works, we need to set a primarykey in my case is the url the reason why is the insertion failed is because of I din't specific my primarkey value during create object.

write_feed = new FeedTable(); // Create a new object