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 1020527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:10:38+00:00 2026-05-16T11:10:38+00:00

I am using Transaction management with Spring and Hibernate. My situation is as follow:

  • 0

I am using Transaction management with Spring and Hibernate.
My situation is as follow:
I have got bean A which is sorrounded by transaction
and it call bean B which is defined with transaction including the attribute ‘PROPAGATION_REQUIRED’

B in this case doesn’t open new transaction but uses the exsiting one (saw in the logs: ‘Participating in existing transaction’). However in case the method in B will throw a runtimeException, on its way back to A it will dirty the transaction and will cause it to be marked for roll-back, even if the external method of A will catch the exception and won’t throw it away. I think that this behavior is wrong, in this case I want A to control the transaction and B should not interrupt the transaction in any case.
Is there any way to define B to open transaction if no transaction defined but DO NOTHING if it is already inside an exising transaction and let the upper level make the decision whether to commit or roll-back?

See more responses about this issue in a thread in Spring community here.

  • 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-16T11:10:38+00:00Added an answer on May 16, 2026 at 11:10 am

    Theoretically it is possible, but not within the standard means of Spring’s Transaction aspects. You would need to create your own aspect that duplicates the spring standard functionality, extending it for your special case. Perhaps it will even be possible to extend the original aspect they use.

    (Probably you will have to define a custom annotation though, because you can neither override the @Transactional attribute nor extend the Propagation enum.)

    Here are some pointers:

    • Spring Transaction Management, especially:
    • Transaction propagation
    • Using @Transactional
    • Using @Transactional with AspectJ

    Also, you should consider reading the book AspectJ in Action, even if you just want to use Spring AOP, as it gives a very good overview.

    A good starting point is to download the sources of the spring-aspects jar, see what they are doing there and provide your own extension of either org.springframework.transaction.aspectj.AbstractTransactionAspect or org.springframework.transaction.aspectj.AnnotationTransactionAspect

    To sum it up: I’m sure it can be done, but it will take a lot of work. The Spring Transaction API is pretty good as it is though. Maybe you should learn to live with it’s limitations. If not: start hacking (see above)

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

Sidebar

Related Questions

As best practice, when using hibernate and spring together which transaction management should I
We have a mixed Java and Scala project, which uses Spring transaction management. We
I am facing a problem with Spring Transaction management. I am using hibernate as
I'm using Spring 2.5 transaction management and I have the following set-up: Bean1 @Transactional(noRollbackFor
I use JPA/Hibernate with Spring transaction management in my application. There is a InspectionEntity
I have been reading about using Spring with Hibernate and I am really confused
The Spring framework provides two means of programmatic transaction management: Using the TransactionTemplate .
I have a Spring 3 application using openJPA as persistence management, following section works
I've been learning how to use the Spring framework for hibernate transaction management, and
I have some problems with Transaction/Session management, since I switched from Hibernate 3.6 to

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.