Entering Data in Entity

0
Hi ,  I have an entity which has 3 attributes  I want to add the data in the entity through custom java code which is being triggered by a microflow  I created the object as parameter to the java code and in eclipse class i am adding the below code. But only the last commit is working i.e the Name – Jones , Company – ASD , Location – USA . I want to add multiple rows in at a time  Input.setName("Anirudh");         Input.setCompanny("ABC");         Input.setLocation("India");         Input.commit();               Input.setName("Gupta");         Input.setCompanny("XYZ");         Input.setLocation("France");         Input.commit();   Input.setName("Jones");         Input.setCompanny("ASD");         Input.setLocation("USA");         Input.commit();
asked
2 answers
1

Hi Anirudh,

For each employee details you need to create object for employee and then you need to set values and commit

 

Thanks!

answered
0

Are you creating a new entity for each Employee, or just reusing the same entity? It sounds like you are reusing, so all you are doing are just updating the same entity each time so the only value will be the last data you set and committed. Try creating a new entity for each Employee.

Is there any reason you are choosing to do this in Java? It will be more maintainable and readable if you can stick to a pure Mendix solution where possible.

Hope this helps.

answered