Is it possible to remove a record from an ICreateBatch?
Once a record has been created by calling the create() method it appears there is no way of removing it in the event of an exception occurring. For example I want to parse the contents of a file into a database and I'm using an ICreateBatch to do so. I have three parameters to add to each record, the first is a date, the second is an integer and third is a string. First up I need to call create(), then I parse the Date and the integer before finally adding the string. However should the date or integer not be valid I cannot then remove the object just created which now contains invalid data which will be committed to the database when the batch is committed. In this simplistic example the code could be structured differently of course but hopefully it illustrates the point.
You're right, there is no way to directly remove a created object in a create batch at the moment. If this is important for you, you could submit a ticket in mxdn. A workaround could be to retrieve the mendix object with batch.getCurrentObject() and keeping a list of those to delete afterwards using a regular remove or removeBatch.