How to change specialization of the row

0
Hi Team,   I have a 3 Entities 1. Details,(Unique contrtaint on Pan card) 2. Employee 3. Intern. The Employee and Intern have Details as a Generalization and there are multiple associations on the  Details entity like Audit..   We have a scenario that the Intern can convert into Employee. How can we convert the current Intern specialization object into an Employee specialization object without deleting the existing object?  
asked
2 answers
1

You can not. You need to create an Employee object and then copy the data over. For the details part you could try to deepclone that part but I would just create a microflow that does all the copying so that it retrieves all the associations of the intern and then set those on the new Employee object.

Regards,

Ronald

 

answered
0

You can not.  The id of the Intern is determined by Mendix during the creation of the object. And it is an attribute of the Intern. It is also copied to the id-attribute of Details, which makes Details have very divers id's.

Changing Intern-object to an Employee-object you would need to create a Java-action to:

- create a new Employee (whitout a Details-object, if Java creates it anyway: remove its Details-object)

- change original Details-object's attribute submetaobjectname from Intern to Employee

- change the Detail.id to the Employee-id

But even then, you will lose all history, since the Details.id has changed.

So, no, it is not possible.

 

An alternative solution would be to refactor your domain-model to have a Person and a Position. But that is beside your question.

answered