Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 14876 invoked from network); 5 May 2009 04:25:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 May 2009 04:25:18 -0000 Received: (qmail 48052 invoked by uid 500); 5 May 2009 04:25:16 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 47993 invoked by uid 500); 5 May 2009 04:25:15 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 47983 invoked by uid 99); 5 May 2009 04:25:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 May 2009 04:25:15 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.142.187] (HELO ti-out-0910.google.com) (209.85.142.187) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 May 2009 04:25:06 +0000 Received: by ti-out-0910.google.com with SMTP id j3so455899tid.5 for ; Mon, 04 May 2009 21:24:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.110.105.5 with SMTP id d5mr506675tic.6.1241497482899; Mon, 04 May 2009 21:24:42 -0700 (PDT) In-Reply-To: <313e92a60905042017h2b633206m3f5e8a9ca0d89e07@mail.gmail.com> References: <313e92a60904301731n59b22643l70cdf9be02e45169@mail.gmail.com> <49FA45AA.1040203@yahoo.com> <313e92a60904301752l1ffc5ades5453d26bbbb522e1@mail.gmail.com> <49FA5CD0.5030703@gmail.com> <313e92a60904301941n61657399qe372102a012409ca@mail.gmail.com> <313e92a60905042017h2b633206m3f5e8a9ca0d89e07@mail.gmail.com> Date: Tue, 5 May 2009 11:24:42 +0700 Message-ID: <3a71add70905042124s766deafevabac85d5f184173c@mail.gmail.com> Subject: Re: @Transactional Spring Annotation in a Struts2 Action does not work From: Frans Thamura To: Struts Users Mailing List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org will u make a tiny tutori for your work like struts-spring-ajax and put in the wiki of S2 that will be awesome ;) F On Tue, May 5, 2009 at 10:17 AM, Mauricio Aniche wrote: > Wes, > > I just put the proxy-target-class=3D"true", put all cglib and its depende= ncies > and everything worked! > > Thanks in advance, > Mauricio > > On Fri, May 1, 2009 at 9:32 AM, Wes Wannemacher 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 >> 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 actio= n >> > should not know about persistence problems, and that's why I want to d= o >> it >> > via AOP. >> > >> > I had the same thought about the problem: the Spring proxy does not wo= rk >> > 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 > >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 act= ion >> >> classes which simply does not work at all with the proxies created by >> >> Spring. >> >> >> >> Regardless, making your actions @Transactional means mixing persisten= ce >> >> concerns with controller logic in the same class. You should consider >> >> keeping the two separated. For example, the service approach is a goo= d >> >> start: >> >> http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html. >> >> >> >> >> >> =A0Yes, 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 >> >>> 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: >> >>>>> ---- >> >>>>> >> >>>>> >> >>>>> >> >>>>> >> >>>> You're using the Spring plugin, correct? >> >>>> >> >>>> Dave >> >>>> >> >>>> >> >>>> -------------------------------------------------------------------= -- >> >>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org >> >>>> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org >> For additional commands, e-mail: user-help@struts.apache.org >> >> > --=20 --=20 Frans Thamura Meruvian. Java and Enterprise OSS Mobile: +62 855 7888 699 Blog & Profile: http://frans.thamura.info We provide services to migrate your apps to Java (web), in amazing fast and reliable. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org