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

  • SEARCH
  • Home
  • 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 6897735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:12:26+00:00 2026-05-27T07:12:26+00:00

in my project I am using two transactional classes. Each class contains save method.

  • 0

in my project I am using two transactional classes. Each class contains save method. When I add @Transactional(roolbackFor=Exception.class) annotation into these classes, for using like

@Component
public class CallerClass{
@Autowired    
private TransactionClass1 class1;
@Autowired    
private TransactionClass2 class2;

public void saveOperation(){    
    try{
        class1.save();
        class2.save();
    }catch(Exception ex){
    }
}
}

if class1.save method is executed without Exception but class2.save method throws an Exception, then class1.save operation is rolled back ?

  • 1 1 Answer
  • 0 Views
  • 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-27T07:12:26+00:00Added an answer on May 27, 2026 at 7:12 am

    No.

    To have this behavior, the method containing these two calls would have to be transactional as well. Moreover, If you instantiate your classes using new, the transactional interceptor won’t be used. You have to get instances of these classes from the application contect, or (preferrably), by dependency injection.

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

Sidebar

Related Questions

I'm using two different libraries in my project, and both of them supply a
My Xcode project builds to variations of the same product using two targets. The
I have been using git to keep two copies of my project in sync,
I'm using classic ASP in my project. I want to merge two XMLs together.
I am using git for windows to manage a local project. I have two
This is a two-part question. I'm using jQuery for a project and wanting to
I'm developing a Java application using Eclipse. My project has two source directories that
I have a WPF project using MVVM. I have two views: ClientView and CommentView
I am creating a basic msi project using installsheild 2012 premier. I have two
I have two same project in which I have two classes under same namespace

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.