Properties properties = new Properties();
UserTransactionManager utm = new UserTransactionManager();
utm.init(properties);
int batchSize = 100;
int totalRecords = 10000;
try {
UserTransaction ut = new UserTransactionImp();
ut.begin();
for (int i = 1; i <= totalRecords; i++) {
// ...
if (i % batchSize == 0) {
ut.commit();
ut.begin();
}
}
ut.commit();
} catch (Exception e) {
// ...
}