Announcement Announcement Module
Collapse
No announcement yet.
propagation_required in TransactionProxyFactoryBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • propagation_required in TransactionProxyFactoryBean

    Hi,

    Could someone explain to me what exactly is the meaning of PROPAGATION_REQUIRED in a typical TransactionProxyFactoryBean configuration, e.g.

    Code:
    <bean id="proxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
      <property name="transactionManager"><ref local="transactionManager"/></property>
      <property name="target">
        <bean class="foo.bar.MyDAOImpl">
            <property name="sessionFactory"><ref local="sessionFactory"/></property>
        </bean>
      </property>
      <property name="transactionAttributes">
        <props>
          <prop key="*">PROPAGATION_REQUIRED</prop>	
        </props>
      </property>
    </bean>
    I looked in the reference manual, but it doesn't say much about it...
    I thought it means that if you call one proxied method within another, as in updateFoo()

    Code:
    class MyDAOImpl() {
    
      public void updateFoo() {
        updateBar();
      }
    
      public void updateBar() {
      }
    }
    then the transaction started by updateFoo() will be propagated to updateBar().

    However, in a separate thread I was told that in a scenario such as the above, updateBar() will not be intercepted when it is called within updateFoo(). So if only one of the method calls is intercepted, then there is no possibility that 2 transactions could ever be started, which doesn't tally with my previous understanding of PROPOGATION_REQUIRED

    Thanks in advance,
    DM

  • #2
    That means that if you try to run new transaction withing existing one (for example, by calling to another service from transactional method of you first service) second transaction will partisipate in your first transaction and will reuse all resources of that one (i.e. db connection, etc.).

    Comment

    Working...
    X