java - @Transactional in the controller -
first of want mention agree make service layer transactional, world not perfect, , right i´m in middle of situation. have been assigned wonderful project legacy code of 4+ years. thing developers did not follow pattern introduce bussines logic can image multiples services call controller , after call private method controller. no budget refactor, , have many issues acid solution found make controllers transactional , @ least have full rollback if in middle of request/response go wrong. problem cannot make works. describe configuration see if can me out guys. have dispatcherservlet invoke webmvc-config.xml have declaration of controllers
<context:component-scan base-package="com.greenvalley.etendering.web.controller**" use-default-filters="false"> <context:include-filter expression="org.springframework.stereotype.controller" type="annotation"/> </context:component-scan>
then contextconfiguration invoke applicationcontext.xml have rest of spring configuration.
after read many tickets tried many convination, example try declare again controllers application context.
<tx:annotation-driven mode="aspectj"/> tried proxy <context:component-scan base-package="com.greenvalley.etendering.web.controller.*" />
but still nothing.
in configuration of txmanager dont nothing fancy, add reference entitymanagerfactory , that´s it
<tx:annotation-driven transaction-manager="transactionmanager"/> <bean id="transactionmanager" class="org.springframework.orm.jpa.jpatransactionmanager"> <property name="entitymanagerfactory" ref="entitymanagerfactory"/> </bean>
in controller add @transactional, nothing every time made request @transactional class/method dont see breakpoint jpatransactionalmanager dobegin method stop
any suggestion please!
regards
Comments
Post a Comment