Skip to content
Advertisement

Making Spring 3 MVC controller method Transactional

I am using Spring 3.1 and have my DAO and service layer(transactional) written.

However in a special case to avoid a lazy init exception I have to make a spring mvc request handler method @transactional. But It is failing to attach transaction to that method. Method name is ModelAndView home(HttpServletRequest request, HttpServletResponse response). http://forum.springsource.org/showthread.php?46814-Transaction-in-MVC-Controller From this link it seems it is not possible to attach transaction (by default ) to mvc methods. Solution suggested in that link seems to be for Spring 2.5 (overriding handleRequest ). Any help will be reallyappreciated. Thanks

JavaScript

Advertisement

Answer

You’ll need to implement an interface so that Spring has something it can use as a Proxy interface:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement