View Full Version : JDBC batch facility
Jan 7th, 2008, 08:17 AM
Hi: I notice that the JDBC batch facilities are not used in any of the examples. Is this due to reliance on the DB manager to handle this processing?
Jan 7th, 2008, 08:58 AM
We don't really provide any database ItemWriters, since there wouldn't be much value in doing so. (Unlike say, a file ItemWriter) You can easily create your own Dao (or ItemWriter) that takes advantage of Jdbc Batching. However, keep in mind that doing so can complicate error processing. To give an example, if you have a chunk of size 10, and the 5th record is bad, if you are using Jdbc batch to output them, you have no way of knowing the 5th record is bad, since all 10 were committed at once. You will receive one exception for all. This can be solved by rolling back the chunk, and processing each one at a time, which isn't too difficult, but please keep in mind that it does add an extra 'layer'.
Jan 7th, 2008, 09:14 AM
yes....I see what you are saying about the error processing.....the supplied output writers, for flat files, do a very good job.
Thanks for the response
Jan 7th, 2008, 12:13 PM
See also http://jira.springframework.org/browse/BATCH-76. It is scheduled for 1.0.
Jan 9th, 2008, 12:10 PM
I looked at BATCH-76. Will it use the same approach as the solution for http://jira.springframework.org/browse/BATCH-194 ?
Jan 9th, 2008, 12:45 PM
BATCH-194 was more about the fact that hibernate wouldn't flush the cache until the transaction was committed. Therefore, they weren't able to catch the error within developer code, since it wasn't thrown until the framework tried to commit a transaction.
However, the solution of using an interceptor may still have value if using a jdbc batching output solution.
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.