使用copyToRealmOrUpdate时,它还会覆盖具有现有值的字段。我希望它只会更新我提供的字段并使用其他字段的现有值。我看到了createOrUpdateFromJson的这个问题:https://github.com/realm/realm-java/issues/933cmelchior是这样说的:Itisimpossibletotellthedifferencebetweenanvaluenotsetandit'sdefaultvalue,sothereitshouldoverrideallproperties.我想为Realm创建标签增强问题,但我先在这里问。真的不
我应该如何使用android中的Realm数据库更新已经存在的值?我一直在尝试更新它,但它只是作为新值添加而不是覆盖它 最佳答案 另一种使用RealmDB中的所有字段更新现有对象的方法是使用realm.copyToRealmOrUpdate()方法:Objectobj=newObject();obj.setField1(field1);obj.setField2(field2);realm.beginTransaction();realm.copyToRealmOrUpdate(obj);realm.commitTransactio
我应该如何使用android中的Realm数据库更新已经存在的值?我一直在尝试更新它,但它只是作为新值添加而不是覆盖它 最佳答案 另一种使用RealmDB中的所有字段更新现有对象的方法是使用realm.copyToRealmOrUpdate()方法:Objectobj=newObject();obj.setField1(field1);obj.setField2(field2);realm.beginTransaction();realm.copyToRealmOrUpdate(obj);realm.commitTransactio
我有以下类(class):publicclassNoteextendsRealmObject{@PrimaryKeyprivateStringid;privateTemplatetemplate;//otherprimitivefields,getters&setters}publicclassTemplateextendsRealmObject{privateStringname;privateStringcolor;//otherprimitivefields,getters&setters}我通过Retrofit和Gson从后端获取数据,因此我有现成的java对象作为响应。假设后