Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create standalone object from realm result in android

Tags:

android

realm

I am new to android realm. I am using follwing code to get product object from realm.

ProductModel prodObj = realm.where(ProductModel.class).equalTo("product_id","12").findFirst();

How can i create standalone copy of prodObj? I want to update some field's value that should not affect in realm database. I don't want to set it manually with setters method because model class contains too many fields. Is there any easy way to create standalone copy of prodObj?

like image 597
Harshal Bhatt Avatar asked Jun 18 '15 13:06

Harshal Bhatt


1 Answers

Since 0.87.0

  • Added Realm.copyFromRealm() for creating detached copies of Realm objects (#931).
like image 81
ar-g Avatar answered Oct 02 '22 18:10

ar-g