Batching objects in a list for DB updates
Posted on 2004-10-16
I wonder if an expert can help.
I have Java List of stock objects Stock  listOfStock.
The nuber of stocks in the list is variable on each run of the program.
I'm going to have a property set up batch_size that will control the number of
stocks I pass for DB/insert/update as I loop through the list.
I wantto say have a batch size of 500. So if there are 2000 stock items, I want
to loop through and submit 500 first , then the next 500 and so on until
I've been through the list.
The nuber of Stock objects in Stock will be variable.
I'm going to have to remember the index where the batch of 500 ended so I can get the
next 500 (or less dependig on list size).
Can you please help with the Java for this?