model - How to make a copy of an object in ebean -
i working play[0] application , using ebean[1] object-relational mapper. have models "immutable" , need clone/copy every time changing.
the actual question is: proper way create copy of object has been retrieved orm? , how handle relations referencing
we have tried nullify ids , persist models again, in case ebean still keep relation previous models.
user user = ebean.find(user.class, id); user.setid(null); user.save(); //will not create copy also tried use ebean._ebean_createcopy()[2] doesn't make deep copy, think.
user user = ebean.find(user.class, id); user = user._ebean_createcopy(); another.setid(null); another.save(); //will create new user keeps old references
Comments
Post a Comment