Wes, I just put the proxy-target-class="true", put all cglib and its dependencies and everything worked!
Thanks in advance, Mauricio On Fri, May 1, 2009 at 9:32 AM, Wes Wannemacher <w...@wantii.com> wrote: > See if you can force Spring to use CGLIB proxies... JDK proxies are > interface-based, so unless you are implementing an interface that > exposes all of the methods you will interact with (Action interface > has no methods, IIRC), then AOP / @Transactional won't work right. > > Although, carry on with the Service layer discussion, I agree with > that and take my fix as no indication that I would ever try to make an > Action transactional (wink). > > -Wes > > On Thu, Apr 30, 2009 at 10:41 PM, Mauricio Aniche > <mauricioani...@gmail.com> wrote: > > Hi Jeroen, > > > > The problem is that I am not a big fan of services layer. Sometimes it > looks > > very anemic to me. But I totally agree with you when you say the action > > should not know about persistence problems, and that's why I want to do > it > > via AOP. > > > > I had the same thought about the problem: the Spring proxy does not work > > properly with all the magic Struts2 and Reflection do! > > > > I tried to open a bug in the Struts2 JIRA, but they closed it and said > that > > it works. I think it should be some kind of spring or struts > configuration I > > am not doing right. > > > > Thanks in advance, > > Mauricio > > > > On Thu, Apr 30, 2009 at 11:22 PM, Jeroen De Ridder <voetsjo...@gmail.com > >wrote: > > > >> You really shouldn't be making your Struts 2 actions @Transactional. > Doing > >> that causes Spring to create a proxy so it can put some extra > >> transaction-handling logic between the method call and the actual > method. > >> The thing is, Struts 2 and OGNL rely heavily on reflection on the action > >> classes which simply does not work at all with the proxies created by > >> Spring. > >> > >> Regardless, making your actions @Transactional means mixing persistence > >> concerns with controller logic in the same class. You should consider > >> keeping the two separated. For example, the service approach is a good > >> start: > >> http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html. > >> > >> > >> Yes, I am. Everything works fine when I don't try to use Spring > >>> transactional AOP! > >>> > >>> Mauricio > >>> > >>> On Thu, Apr 30, 2009 at 9:43 PM, Dave Newton <newton.d...@yahoo.com> > >>> wrote: > >>> > >>> > >>> > >>>> Mauricio Aniche wrote: > >>>> > >>>> > >>>> > >>>>> I am using Struts2+Spring+JPA/Hibernate. When I use the > @Transactional > >>>>> to > >>>>> mark an execute() method in a Struts2 Action, the action stops > working > >>>>> properly (i.e. the attributes in the action are not automatically > >>>>> setted). > >>>>> It does not work with Spring AOP transactions as well. > >>>>> > >>>>> In my struts.config I setted the following constant: > >>>>> ---- > >>>>> <constant name="struts.objectFactory" value="spring" /> > >>>>> > >>>>> > >>>>> > >>>> You're using the Spring plugin, correct? > >>>> > >>>> Dave > >>>> > >>>> > >>>> --------------------------------------------------------------------- > >>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > >>>> For additional commands, e-mail: user-h...@struts.apache.org > >>>> > >>>> > >>>> > >>>> > >>> > >>> > >>> > >> > >> > > > > > > -- > Wes Wannemacher > Author - Struts 2 In Practice > Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more > http://www.manning.com/wannemacher > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >