More batch problems

0
I have got the batch process to work, but still encounter java.lang.OutOfMemoryError: Java heap space errors. I have started with a batch size of 1000 invoices. I am now down to 100 but still get these out of memory errors. The heap space is set to 128 mb. Am I the only one that think it is strange that Mendix can not handle this batch size? The only action that is performed is retrieving the invoice, doing some date calculation and storing the four results in a new entity. In my opinion not really memory intensive. But why am I getting these out of memory errors? This is the microflow: This is the javacode: // This file was generated by Mendix Business Modeler 2.5. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list // - the code between BEGIN USER CODE and END USER CODE // - the code between BEGIN EXTRA CODE and END EXTRA CODE // Other code you write will be lost the next time you deploy the project. // Special characters, e.g., é, ö, à, etc. are supported in comments. package rapportage.actions; import com.mendix.core.Core; import com.mendix.systemwideinterfaces.core.UserAction; import com.mendix.systemwideinterfaces.core.IMendixObject; import java.util.HashMap; import java.util.List; import java.util.Map; /** * */ public class GetFactuurBatch extends UserAction<List<IMendixObject>> { private Long amount; private Long offset; public GetFactuurBatch(Long amount, Long offset) { super(); this.amount = amount; this.offset = offset; } @Override public List<IMendixObject> executeAction() throws Exception { // BEGIN USER CODE Map<String, String> sort = new HashMap<String, String>(); sort.put(facturen.proxies.Factuur.MemberNames.FactuurInternNummer.toString(), "asc"); List<IMendixObject> List = Core.retrieveXPathQuery(this.getContext(),"//Facturen.Factuur", amount.intValue(), offset.intValue(), sort); return List; // END USER CODE } /** * Returns a string representation of this action */ @Override public String toString() { return "GetFactuurBatch"; } // BEGIN EXTRA CODE // END EXTRA CODE }
asked
1 answers
1

This implementation has nothing to do at all with what we call 'batching', because all objects are still stored within the same database transaction. You just split the retrieve in several parts which will only make your app slower, not faster.

Please take a look at the batching module in the appstore, the documation about batching, existing forum questions about batching or the batching implementation in community commons.

answered