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

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

    Hi,

    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
    Code:
    	<!-- Transaction Manager-->
    	<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory" ref="hibernateFactory"/>
    	</bean>	
         
           <!-- AOP Config -->
    	<aop:config proxy-target-class="true">
    		<aop:pointcut id="pcutAuthentication" expression="execution(* com.portsdirect.sms.web.backingbeans.AuthenticationBackingBean.*(..))"/>
    	</aop:config>
    
    	<!-- Advice -->
    	<tx:advice id="advAuthentication" transaction-manager="txManager">
    		<tx:attributes>
    			<tx:method name="sendNewPassword" propagation="REQUIRED" rollback-for="com.portsdirect.sms.bi.PortsDirectBIException"/>
        		<tx:method name="changePassword" propagation="REQUIRED" rollback-for="com.portsdirect.sms.bi.PortsDirectBIException"/>
    		</tx:attributes>
    	</tx:advice>
    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 ?
Working...
X