Announcement Announcement Module
No announcement yet.
Proper way of handling JDBC transactions Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Proper way of handling JDBC transactions

    Hi all,

    Can somebody please shed some light on how to properly use JDBC transactions with SI?
    Usually I declare transactionManager bean using org.springframework.orm.hibernate3.HibernateTransa ctionManager, then I wrap all DAO beans like:

    <bean class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    	<property name="transactionManager" ref="transactionManager" />
    	<property name="target">
    		<bean class="target.dao.class">
    I understand, that I should wrap my Transformers, ServiceActivators, etc. with TransactionProxyFactoryBean (if I use them with JDBC operations). Is it correct? Or maybe SI detects transactionManager itself?

    Let's say I have following flow:

    1. jdbc consumer
    2. transformer
    3. jdbc backed queue

    In case of any exception in transformer's or queue's code I do not want jdbc consumer to delete record from the source table.
    How should I place all three above components within single transaction?


  • #2
    Start the transaction at the poller.

    All downstream endpoints will run in the same transaction (so long as you don't do any async handoffs).

    See the appendix for a complete description of transaction support in Spring Integration.