Announcement Announcement Module
Collapse
No announcement yet.
TransactionProxyFactoryBean with pre and post interceptors Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • TransactionProxyFactoryBean with pre and post interceptors

    I am using the TransactionProxyFactoryBean to manage my transactions with Hibernate. I have written an "after returns" interceptor to perform auditing of my actions, which also uses Hibernate to write to an audit table.

    Will the interceptor call be included in the transaction? If not, how can I achieve this, since I need the actions to be atomic?

    My bean looks like this:

    <bean id="dealManager" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="transactionManager"><ref bean="transactionManager"/></property>
    <property name="target"><ref local="dealManagerTarget"/></property>
    <property name="transactionAttributes">
    <props>
    <prop key="searchMatchingBlotter">PROPAGATION_REQUIRED</prop>
    <prop key="cancelDeals">PROPAGATION_REQUIRED</prop>
    <prop key="cancelDeal">PROPAGATION_REQUIRED</prop>
    <prop key="deferDeals">PROPAGATION_REQUIRED</prop>
    <prop key="revertDeals">PROPAGATION_REQUIRED</prop>
    <prop key="externallyConfirmDeals">PROPAGATION_REQUIRED</prop>
    <prop key="quickMatchDeals">PROPAGATION_REQUIRED</prop>
    <prop key="quickMatchDeal">PROPAGATION_REQUIRED</prop>
    <prop key="breakMatchDeals">PROPAGATION_REQUIRED</prop>
    <prop key="getDeal">PROPAGATION_REQUIRED</prop>
    <prop key="generateQuickMatchDeal">PROPAGATION_REQUIRED</prop>
    <prop key="saveDeal">PROPAGATION_REQUIRED</prop>
    <prop key="addComment">PROPAGATION_REQUIRED</prop>
    </props>
    </property>
    <property name="preInterceptors">
    <list>
    <ref local="securityInterceptor"/>
    </list>
    </property>
    <property name="postInterceptors">
    <list>
    <ref local="auditInterceptor"/>
    </list>
    </property>
    </bean>

  • #2
    PostInterceptors are applied after the transaction interceptor, so Yes, your audit interceptor will execute within the same transaction as your target class.

    HTH

    Comment


    • #3
      great, thanks!

      Comment

      Working...
      X