I'm not sure what is the best way to do this.
In my business logic I have a query which could return over 100,000 rows from a database. I want to iterate over these objects, modify them and update them back to the database. Doing 100,000 updates in one transaction is not possible and doing every update in it's own transaction is also not possible. For performance reasons I want to commit updates in groups of 10,000 or so. My question then is, what is the best way to do this with Spring and Hibernate? I would like to use declarative transactions if possible. Do I have to implement my own PlatformTransactionManager? Is there some way I can place a setting on my datasource in a similiar way to autocommit is set on a datasource? Am I forced to use programatic transactions and keep a counter running in my app and do the commit when it reaches 10,000 updates?
I'm hoping it is a feature that is already supported and I am just unware of how to use it.
Any ideas?
Thanks
Dave


Reply With Quote