Announcement Announcement Module
Collapse
No announcement yet.
can it support a database with no transactions? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    JTA is the only bullet proof option. Some people rely on single-phase commit of multiple datasources, risking unrecoverable failure in between commits of two connections from different data sources. Spring doesn't (yet) support that out of the box though - you have to write your own PlatformTransactionManager, or use two DataSourceTrabsactionManagers and use TransactionSynchronizations to link up the commits.

    Comment


    • #17
      Looking in a little deeper, there's one thing that still puzzles me. The user guide suggests this configuration

      Code:
      	<aop:config>
      	    <aop:advisor 
      	    	pointcut="execution(* org.springframework.batch.core..*Repository+.*(..))"
      	    	advice-ref="txAdvice" />
      	</aop:config>
      	
      	<tx:advice id="txAdvice" transaction-manager="transactionManager">
      	    <tx:attributes>
      	        <tx:method name="create*" propagation="REQUIRES_NEW" isolation="SERIALIZABLE" />
      	        <tx:method name="*" />
      	    </tx:attributes>
      	</tx:advice>
      By putting REQUIRES_NEW on the repository DAOs, then we in fact are running in a different transaction than the original (which is suspended). This new repository transaction will commit independently of whether the step's transaction committed.

      So I wonder if that's a typo, and it should be REQUIRES, or whether I should just inject the ItemWriter's database's local tx manager and bag JTA (I hope :-)

      Comment


      • #18
        That method is never called inside another transaction started by Spring Batch. It is there to force the transaction manager to adopt the correct attributes if the user mistakenly has wrapped the call to Job.execute() in a transaction.

        Comment


        • #19
          got it! Thanks so much!

          Comment

          Working...
          X