Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3600334
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:28:55+00:00 2026-05-18T20:28:55+00:00

I have been working for a while on a project with the following components:

  • 0

I have been working for a while on a project with the following components:

  • Struts2.1.8.1,
  • Spring 3.0.3
  • JPA 2.0,
  • Hibernate 3

I am using Spring’s EntityManager magic… But I’m having problems dealing with transactions inside my actions. For instance, I am setting values on my persisted object in several methods within my class, and I want to be able to rollback if the validate method finds a validation error, or commit these changes otherwise. I have already spent quite a long time reading half of the internet for a comprehensive explanation. Unfortunately, no complete examples exist (at least similar to my stack).

I have stumbled with this thread on a mailing list: @Transactional Spring Annotation in a Struts2 Action does not work. The message I’m linking at seems to have a pretty simple and straightforward solution, using a TransactionInterceptor will do the trick it seems… The problem is that I’m not finding useful information regarding this interceptor.

Anyone here has experience with this technology and can spare a tip and a link or two on how to use Spring transactions inside Struts2 actions?

Thanks!

– Edit 1 –

I have set up a test project if you are interested, just download the file and try it out (or inspect it). Thanks!

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T20:28:56+00:00Added an answer on May 18, 2026 at 8:28 pm

    Generally, controllers/actions/backing beans/etc don’t handle transactions. Actions are the web-part of your back-end code – they should only be concerned with gathering request data, and sending response data. The logic itself (including database access) should be done in another layer. E.g. a service layer. So you create another bean, inject it in the action, and make it do the work – userService.register(user). Then configuring transactions on a service layer should be trivial since it is both in the spring documentation and in countless examples:

    <tx:annotation-driven /> and @Transactional (btw, make sure you have the <tx:..> now, it might be causing the issue. Even if it works, this does not invalidate my suggestion about the service layer)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working for a while on a project with the following components:
So I have been working on this project for a short while now. I
I have been working on it for quite a while, but still can't figure
I have been working with XML for a while now, but some things I
I have been working on a huge project for work for a while now,
Say I have been working on a project for a while, added a few
I have been working on to create a sample RMI project for a while
I've been working on a project using python with OpenGL for a while now.
I had been working on a WPF project for a while, but haven't touched
I have been working with System.DirectoryServices for a while in a project involving Active

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.