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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:51:44+00:00 2026-05-17T15:51:44+00:00

Could please anybody tell me If it is safe and recommended to catch SQL

  • 0

Could please anybody tell me If it is safe and recommended to catch SQL and other exceptions within @Transactional methods ? When programmatic transaction management is used, I can simply catch the exception and do whatever I want, but I don’t know if I don’t break the transactional AOP system by catching these exceptions that would otherwise trigger the rollback … if I do it declarative way.

I suppose there are proxies, that create a logical transaction with separate connection for @Transactional methods in the AOP advices. And they need to catch the exception that “I want to catch” and roll the transaction 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-17T15:51:45+00:00Added an answer on May 17, 2026 at 3:51 pm

    You can mark the transaction programmatically as rollback-only using this code

    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
    

    See Rolling back a declarative transaction in the Spring Reference.

    But it’s not recommended, because you are coupling your code tightly to the spring framework.


    Perhaps, if you do that in more than one place, you should introduce a Helper Method, something like TransactionUtils.rollbackCurrentTransaction(). That way, if you decide to change your transactional approach (or god forbid, move away from spring), you only have to change one method.

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

Sidebar

Related Questions

could please anybody tell me what is wrong with this regexp ? ((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\\:([0-9]{2,5}) for
Could anybody please tell me what is the main difference between C & C++
Could anybody please tell me which is best guide/book/material for socket programming in C?
Is anybody using Python 2.3 for Leopard? If so, could you please tell me
could please anybody tell us if it is possible and if it is not,
Can anybody please explain how this could possibly happen? I am completely aware of
Could someone please tell me which objects types can be tested using Regular Expressions
Could anybody tell me how I can override HashSet's contains() method to use a
Can anybody please tell me what the Constructors are used for exactly in Java?
Could please anybody explain what are pros and cons of this? I mean, without

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.