Announcement Announcement Module
No announcement yet.
Transaction not working for non-action methods [JSF] Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Transaction not working for non-action methods [JSF]


    I have a JSF application integrated with Spring, with the help of ContextLoaderListener and RequestContextListener (configured inside web.xml). I have configured transactions on some backing-bean methods using Spring AOP.

    My issue is that, transaction works for any action method, not for any other methods.

    Here are configurations
    	<!-- Transaction Manager-->
    	<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory" ref="hibernateFactory"/>
           <!-- AOP Config -->
    	<aop:config proxy-target-class="true">
    		<aop:pointcut id="pcutAuthentication" expression="execution(* com.portsdirect.sms.web.backingbeans.AuthenticationBackingBean.*(..))"/>
    	<!-- Advice -->
    	<tx:advice id="advAuthentication" transaction-manager="txManager">
    			<tx:method name="sendNewPassword" propagation="REQUIRED" rollback-for=""/>
        		<tx:method name="changePassword" propagation="REQUIRED" rollback-for=""/>
    Here, method changePassword is an action-method (set as an action of a commandButton) in the JSF page, where as, method, sendNewPassword is not an action method. If I call sendNewPassword from inside a different (non transactional) action-method, no transaction is propagated for sendNewPassword. I cannot see the log message from the HibernateTransactionManager saying - opened a new session for transaction, where I can see that in the case of changePassword, which is an action method.

    Do I have to add any extra setting to have a non-action-method be transactional ?