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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:28:08+00:00 2026-06-01T01:28:08+00:00

I am working on a project that has Spring based Web Services and Spring

  • 0

I am working on a project that has Spring based Web Services and Spring Jdbc based persistence.
I have configured a DataSourceTransactionManager to manage the transactions and applied this to the service layer using a Pointcut.
Transaction propagation level is set REQUIRED.

The queries are issued through Spring provided JdbcTemplate.

The problem is that in case of multiple concurrent request to a service i get a MySQLTransactionRollbackException(“Deadlock found when trying to get lock; try restarting transaction”).

Apparently one of the transactions has obtained a lock which makes the second one fail.

My question is – How should configure Spring to delay the execution of the service until a lock is obtainable, instead of just giving up and throwing an exception?

I can’t even catch the exception and try to re-execute the query because I’ve applied transaction on service layer as an advice keeping my DAOs clean.

I’m hoping to get a declarative solution only (since I am an AOP fanatic & crusader against boilerplate code 🙂 ). But even programmatic solutions are welcome.

Thanks for your suggestions.

Update –

@ninjalj Yes it was actually a real deadlock. Turns out I was writing my test case incorrectly. Silly me 🙁

  • 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-06-01T01:28:10+00:00Added an answer on June 1, 2026 at 1:28 am

    If I’m not mistaken, that indicates a real deadlock, so you should really retry the transaction. IIRC, a timeout waiting for a lock has “timeout” in the exception message.

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

Sidebar

Related Questions

I have been working on a project that has 2 interfaces - windows forms
I'm working on a project that requires a Web-based workflow application. We're now evaluating
I am working on a project that has grown to a decent size, and
I am working in a project that has two main parts: a class library
I'm working on a project that has a rich object model with various sets
I am working on a project that has a class 'A' that contains a
I am working on a project that has a requirement such that login details
I'm currently working on a project that has scope to become quite large, however
I'm currently working on a project that has a svn repository. I'm used to
I'm currently working on a project that has a sizable amount of both client

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.