Search code examples
androidrealm

Is it possible in realm to change the primary key later..?


I set a temporary primary locally and save the object to realm, and later the server assigns a unique key for the object and then I want to update the primary key for the object.

So is it possible to reassign a primary key for the object? And what happens when we reassign a primary key to the object? Will it save the object with the old primary key?


Solution

  • It is possible to change the value of a primary key up to Realm 1.2.0.

    It is prohibited to change primary key value since Realm 2.0.x.