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
Error is received if some object from internal RealmList already exists in the database. Haven't tried with just object instead of list.
Received error: Object with this primary key already exists.
The text was updated successfully, but these errors were encountered:
Here is replication of failed scenario. Checked and it fails with the same error:
open class TestEntity : RealmObject {
@PrimaryKey
var id: Long = TestIdGenerator.EntityId
var children: RealmList<TestEntity> = realmListOf()
}
object TestIdGenerator {
var EntityId: Long = 0
get() =
field++
}
suspend fun test() {
val one = TestEntity()
val two = TestEntity()
val three = TestEntity().apply { children = realmListOf(one,two) }
realm.write {
val result = kotlin.runCatching {
this.copyToRealm(one, MutableRealm.UpdatePolicy.ALL)
this.copyToRealm(two, MutableRealm.UpdatePolicy.ALL)
this.copyToRealm(three, MutableRealm.UpdatePolicy.ALL)
}
result
}
}
Error is received if some object from internal RealmList already exists in the database. Haven't tried with just object instead of list.
Received error: Object with this primary key already exists.
The text was updated successfully, but these errors were encountered: