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




Reply via email to