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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:33:05+00:00 2026-05-23T13:33:05+00:00

We are working on a restful application that has a ‘whiteboard’ like feature. I

  • 0

We are working on a restful application that has a ‘whiteboard’ like feature. I had asked a related question on it at one point: Is there a concurrency problem here? How to test it during development?

We first chose to implement the core functionality without concurrency in place just ’cause the application was largely unfamiliar and we had to iron out implementation risks. Since I am well aware of concurrency concepts/issues I felt that it could be possible to delay the concurrency/conflict management code till the best possible time. It seems it was until now 🙂

On the whiteboard multiple team members are able to create/read/update/delete records. The conflicts that can primarily arise are due to update and delete (a bit stale read is considered okay, we fetch periodic updates)

Scenario: Every record that is returned has an id as well as the last timestamp as set by MySQL’s NOW() when the record was first created.

Conflict Scenario:

  1. Just before updating check if timestamp is valid (or if the row even exists) Basically a select * from ... where... query followed by a timestamp check and update if same else ‘merge’ (i.e., just append to current data with ——-CONFLICT/MERGED——- as delimiter)

This seems to be the only conflict scenario so to speak (can anyone spot anything else that I may be missing?)

So the question is how to actually implement this concurrency/conflict check? The scenario needs to be atomic i.e., check if value exists/or is same and then update. Is creating a transaction the way to go? I’m not sure if just going via Spring transaction and firing 2 queries (one for select and the other for update) works or is there an SQL syntax that could help me with this atomicity requirement.

My question is “how to do it”? I’ve read about SELECT…FOR…UPDATE but don’t understand how does it work nor do I understand how SELECT…LOCK IN SHARE MODE could/would solve the problem.

Any ideas/pointers would be really helpful 🙂 Using Restlet/Spring-Jdbc/MySql

  • 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-23T13:33:06+00:00Added an answer on May 23, 2026 at 1:33 pm

    If I was in your position I would hook up a spring transaction manager (http://static.springsource.org/spring/docs/3.0.x/reference/transaction.html) and annotate either my dao or service layer methods with @Transaction.

    Using SELECT…FOR…UPDATE can be used but you would have to be working in a very highly concurrent environment to justify it

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

Sidebar

Related Questions

I've been working on a rails app that uses the restful authentication plugin. It
I am working on a backend Grails application that pulls information periodically from a
We are currently working on the design of a RESTful application. We have decided
My team has a web site with a RESTful API. We're is working on
Working with a SqlCommand in C# I've created a query that contains a IN
Working on a project that parses a log of events, and then updates a
Working with TCL and I'd like to implement something like the Strategy Pattern .
Working with an Oracle 9i database from an ASP.NET 2.0 (VB) application using OLEDB.
I'm designing a RESTful Web app that will provide an authentication system for several
I am working on a system that splits users by organization. Each user belongs

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.