Note: This page uses Javascript. You are seeing this note because your browser either doesn't support Javascript or Javascript is turned off. To view this help system as it is meant to be viewed please use a Javascript enabled browser.

Batch Exception Handling

Previous TopicNext TopicContents

BatchException allows you to catch and collect all business rule exceptions without stopping the batch create/update transaction. After the whole batch create/update is processed, the data transaction is still rolled back but BatchException provides you a list of business rule exceptions that occurred during the process. Looping through the exception list, you can identify the problematic business objects. You might want to remove those from the transaction list and rerun the batch update/create again.

Example: Catching BatchExceptions and looping through the exception list:



// call update or create here... ...


catch ( BatchException e )


// Display stack trace of batch exception



// Display index and exception message of all exceptions in the batch exception

List exceptions = e.getExceptionList();

for ( int i = 0; i < exceptions.size(); i++ )


ServerException se = (ServerException)exceptions.get(i);

System.out.println( se.getSource() + " - " + se.getMessage() );



Legal Notices
Copyright © 2003, 2013, Oracle and/or its affiliates. All rights reserved.

Last Published Wednesday, March 20, 2013