Results 1 to 3 of 3

Thread: TransactionProxyFactoryBean with pre and post interceptors

  1. #1

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Montréal, Canada
    Posts
    845

    Default

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

    HTH
    Omar Irbouh

    Spring Modules Team
    http://irbouh.blogspot.com/

  3. #3

    Default

    great, thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •