marcoarment / FCModel

An alternative to Core Data for people who like having direct SQL access.
MIT License
1.65k stars 173 forks source link

Support creating duplicate instances in parrallel #126

Closed lynns closed 9 years ago

lynns commented 9 years ago

I currently get an SQL duplicate primary key exception if I create two objects with the same primary key value and then save them. The second save fails with a duplicate key exception. I'm calling reloadAndSave but because both instances are created before either are saved, both objects are marked as needing to be inserted. This change will update the second object as strictly an update if the reload finds an existing object in the db with the same primary key.

marcoarment commented 9 years ago

Have you tried the unique2 branch? It's meant to supersede this, and shouldn't have this problem.

lynns commented 9 years ago

I hadn't tried that branch yet because I was waiting to see an update about how it was going in the wild before I switched over. Is that branch working well for you?

lynns commented 9 years ago

I'll try out the unique2 branch and see how that goes for us.