Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 30667 invoked from network); 1 May 2009 02:42:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 May 2009 02:42:32 -0000 Received: (qmail 96654 invoked by uid 500); 1 May 2009 02:42:28 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 96605 invoked by uid 500); 1 May 2009 02:42:28 -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 96595 invoked by uid 99); 1 May 2009 02:42:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 May 2009 02:42:28 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mauricioaniche@gmail.com designates 74.125.44.29 as permitted sender) Received: from [74.125.44.29] (HELO yx-out-2324.google.com) (74.125.44.29) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 May 2009 02:42:20 +0000 Received: by yx-out-2324.google.com with SMTP id 8so1218939yxb.17 for ; Thu, 30 Apr 2009 19:41:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type; bh=tbsl1yHYUm19G0lkVDKbLbMdLibryyu6F0PacSfE/nQ=; b=Ef5lMY/xt6zYOLlVZWgHyFGsMYBSRvvthXGR3J+AXRZmW1bKAqiWA7hrD1eL3qSizi 1I+PK8Eo0ltEsQqr5UtNx+VqGb9ynv4PxvWq9RRQxShQHptyB0BDZHbbXweQ9z3csIji 9LPkKafy/ORcGPR+m4XnIXtd2VORtRtVIseqQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=EstKPzh2SVSbM5cCa7umKLgyfUOmwsnmlKUKFGTg0+u/k6altSIOh7jD5aPiC0/ABW xEa4GSx+l58wgzM8wCJ74UJYKHhuTCSBobegqftq8RdUY6acQsyxafge54CoNvUVSDIJ FtIhj7c3/wsxlFQW0zBB1T3eM4TR2HIi68YKg= MIME-Version: 1.0 Received: by 10.100.248.16 with SMTP id v16mr4806897anh.60.1241145719266; Thu, 30 Apr 2009 19:41:59 -0700 (PDT) In-Reply-To: <49FA5CD0.5030703@gmail.com> References: <313e92a60904301731n59b22643l70cdf9be02e45169@mail.gmail.com> <49FA45AA.1040203@yahoo.com> <313e92a60904301752l1ffc5ades5453d26bbbb522e1@mail.gmail.com> <49FA5CD0.5030703@gmail.com> From: Mauricio Aniche Date: Thu, 30 Apr 2009 23:41:39 -0300 Message-ID: <313e92a60904301941n61657399qe372102a012409ca@mail.gmail.com> Subject: Re: @Transactional Spring Annotation in a Struts2 Action does not work To: Struts Users Mailing List Content-Type: multipart/alternative; boundary=0016369201d0b61c980468d0c1c7 X-Virus-Checked: Checked by ClamAV on apache.org --0016369201d0b61c980468d0c1c7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 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 >> 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 >>> >>> >>> >>> >> >> >> > > --0016369201d0b61c980468d0c1c7--