Cloning complex objects in Mendix / Deep clone

0
Hi all   Purpose of this post is to find an answer the cloning of complex object structure in Mendix. The use case is to clone the parent object and its associated objects (also reverse associations). As you can imagine you very ofter would want to do something linke “Create a new Project from existing one”   I have tried using community commons deep clone java action, but I facing the following issues:   Unable to use deep clone for more than 2 level deep entity structure. The output is not as desired, the associations of the source object are set to null for an unknown reason. We must commit every object to use deep clone and the cloned objects are also committed which is not the use case of the project.   Due to these reasons, we now need to clone every object manually, if you have a lot of related entities you can imagine how complex the microflow structure can get.   Do you know if there is any easier way of just completly cloning an object including cloning all sub entities?   Thank you   Thanks & Regards SG
asked
2 answers
3

Unfortunately not. Cloning of references is way to tricky we learned through the years. We ended up only using the clone action for the normal attributes and then copying the references ourselves in change actions so we have exact control on which refernces are set. In the past we had to many surprises when doing the deepclone.

Regards,

Ronald

 

answered
0

Did you find any solution on it ,please let us know

answered