Creating 1000 objects efficiently

0
I noticed the ICreateBatch functionality is deprecated. Is this the new correct way to create and commit multiple objects? IContext context = this.getContext(); List<IMendixObject> users = new ArrayList<IMendixObject>(); List<IMendixIdentifier> userRoles = new ArrayList<IMendixIdentifier>(); userRoles.add(this.retrievedUserRole.getMendixObject().getId()); for (int i = 1; i <= 1000;i++) { IMendixObject user = Core.instantiate(context, "System.User"); user.setValue(context, "Name", "User" + i); user.setValue(context, "Password", "?" + i); user.setValue(context, "System.UserRoles", userRoles); users.add(user); } Core.commitWithoutEvents(context, users); return true; It takes 1,5 minutes to create 1000 objects on my laptop, is this acceptable or will another method create the objects faster?
asked
1 answers
6

Roy,

You could simply do this in the modeler without any java. Just create a loop that creates the objects without saving and add the created objects to a list. Then after the loop use the commit action for which you use the list as the input. Don't know if it is faster but it's worth a try. Like this mockup alt text

answered