-
May 3rd, 2011, 02:57 PM
#1
Transaction manager with In-Memory Derby JobRepository + MySQL DB for data
Hi,
What are the implications/caveats of using non-JTA TransactionManager, while having JobRepository as an In-Memory DB (H2 or Derby) and having business data in MySQL DB, being read by JpaPagingItemRead and updated by JpaItemWriter ?
Thanks
Jakub
-
May 4th, 2011, 01:09 AM
#2
Spring Batch can't guarantee the synchronization between business data and batch metadata in case of failure (e.g. the number of skipped items could be wrong). This could happen for corner cases, not on a "sunny day".
-
Jun 30th, 2011, 02:34 PM
#3
And how about having actually two transaction managers , one for the Spring Batch (in-mem) DB and the other for the business data DB ?
-
Jul 3rd, 2011, 02:16 PM
#4
They should bind to different threads. You can have multiple transaction managers tied into different datasources. Does this clarify your question?
-
Jul 4th, 2011, 02:59 PM
#5
They for sure will be tied to different datasources, one into the Spring Batch in-mem Derby DB (for job-repository) and the other into the business data DB. But as regards them being bound to different threads, I'm not sure about this one. I don't think I can tell Spring Batch to somehow manage this. Or do they really have to be each in a separate thread ?
Last edited by Jakub.Kahovec; Jul 4th, 2011 at 03:23 PM.
-
Jul 4th, 2011, 03:41 PM
#6
There's a rudimentary example of synchronizing 2 database commits in my article in Javaworld (http://www.javaworld.com/javaworld/j...nsactions.html) - it could do with some tweaks but it probably works for simple use cases. Spring doesn't provide a transaction manager that works this way out of the box (mainly because it is buyer beware - you have to be confident you know what you are doing), but all the APIs are there to make your own. As explained in the article, it doesn't give you the full protection of XA, and you need to be prepared for partial failures.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules