From my experience, the problem is with recreating of objects using NPE (non-persistable entities).
Here are some details:
- Mendix indeed complains about the Number of non-persistable objects created and if it exceeds threshold.
- But the message by itself is not the problem. You could actually suppress the message with a setting.
- The actual problem is: You JVM is struggling and probably might soon run out of memory if you access this page with 300 objects multiple times or with multiple sessions. Look in the RAM usage of the system, check it locally with some Java profilers.
- If it is possible to avoid creating NPE then that is the best approach. Try associations as Joshua mentioned
- Or put some limitations on the number of objects being processed (meaning do not process 300, probably try 100). And this is purely depending upon the load you anticipate with number of users against the INFRA you provided.
- Clear the NPE when the user navigates out of page. Because objects remain in memory.
From some documentations I know Mendix mentioned that NPE’s are not really performance blockers and they are handled effectively. But my experience with the facts I collected differs a lot with documentation.
This is probably caused by sending more than 100 objects to the client.
Have you checked your log? You might notice the following line:
Request state size of ... objects exceeds the threshold of 100 objects.
You can try to solve this by not creating the Non Persistant objects but by using the actual entity with references to the second entity or with regular expressions.
For more information you can read the following page:
Put a breakpoint in the microflow source to see which part is taking time.
My assumption is that because you are creating 300 objects, which is a lot, the page take very long to open.
If you can use a datagrid, there is a new server side pagination system that could be useful (you will create for example 20 object every time the user is changing the pagination)
if you need to use a listview :
If those two entities are linked one to another, you will only need to create a listview and display the values that you want in that listview (in that way no need to create an non persistable object).
If this is not doable, maybe there is a way for you to create another a persistable entity, that will contain all the attribute of the two entities that you want. This entity will be populate when you will create / modify one of those two entities. Then you just have to display that entity in the listview. Be aware that this solution will use extra storage space.