Announcement Announcement Module
No announcement yet.
Using different transactionManager for Metadata and Business-Data Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using different transactionManager for Metadata and Business-Data

    Hi Batch-Users,

    I successfully wrote my first batch-application and used one DataSourceTransactionManager for the Batch-Metadata and one JpaTransactionManager for the business logic configured into the step. In my small tests it works as expected but now I read a book about Spring-Batch an it says to use the same TransactionManager for both or I could end up with inconsistencies between metadata and business-data.
    Now I'm confused about that. I would have expected it to be a feature: The batch-framework can persist the batch-state an -errors independently of the business-logic. So that the business-logic is not able to break the batch-'protocol'.

    It would be great if someone could explain that to me. Thanks in advance!!!

  • #2
    If you want consistency across multiple datasources, you need to use a transaction manager that supports distributed transactions. The processing of the data is coupled to the state that is being persisted so the use of transactions to either commit both or rollback both is a logical implementation.