Announcement Announcement Module
Collapse
No announcement yet.
Declaring multiple exception types for TransactionProxy Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Declaring multiple exception types for TransactionProxy

    Is there a way to declare multiple (not just one) exception types for TransactionProxy bean. For example, I have:
    - com.acme.CreateReportException
    - com.acme.CreateAnotherException
    - com.acme.CreateThirdException

    and I want for all methods that starts with create prefix intercept all above exceptions to roll the transaction back. See and fix the supplied code below please.

    Code:
    <bean id="myManager" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
          <property name="transactionManager"><ref bean="myTransactionManager"/></property> 
          <property name="target"><ref local="myManagerTarget"/></property>  
          <property name="transactionAttributes">
            <props>
               <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
               <prop key="create*">PROPAGATION_REQUIRED,-com.acme.CreateReportException</prop>
               <prop key="remove*">PROPAGATION_REQUIRED,-com.acme.RemoveReportException</prop>
    	    </props>
          </property> 
        </bean>
    Thanks for your time and assistance!

  • #2
    Can you not simply append the exceptions names, i.e.:
    Code:
     <prop key="remove*">PROPAGATION_REQUIRED,-com.acme.RemoveReportException,-com.acme.CreateReportException </prop>
    ???

    Comment

    Working...
    X