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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:04:13+00:00 2026-05-25T17:04:13+00:00

I have this scenario ,on a airline website (using Java) two separate customers send

  • 0

I have this scenario ,on a airline website (using Java) two separate customers send two requests at same time to book a same seat in same airline
from New York to Chicago. I am using the oracle database and isolation level is read committed.My question here is that does oracle database provide
any solution to deal with this kind of concurrent scenario?
what I know is when first transaction DML statement is fired it will get a lock on affected
rows and will release when transaction completes i.e on issuing rollback or commit.But as soon as commit is done and second request will proceed as soon as
first is completed and will override the first one.So it does not help?

Yes in Java I can deal with making my db class as singleton and using synchronized keyword on method which is doing update. But want to know is there
anyway we can this kind of issue at database level itself?Probably isolation level as serializable can help. But not sure?

  • 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-25T17:04:14+00:00Added an answer on May 25, 2026 at 5:04 pm

    To handle concurrency in a web site a common practice it to have a column on each record that allows you to check it has not been updated since you got it. Either last update date or a sequential version number (auto incremented by a trigger).

    Typically you will read the data (plus the concurrency column)

    SELECT seat,etc,version_no
    FROM t1
    WHERE column = a_value
    

    Then when the user eventually gets round to booking the seat the update will work unless there has been an update.

    (the version number or update date will change after every update)

    BEGIN
        UPDATE t1
        SET seatTaken = true
        WHERE seatid = .....
        AND version_no = p_version
        RETURNING version_no INTO p_version;
    EXCEPTION WHEN NOT_FOUND THEN
        --Generate a custom exception 
        --concurrency viloation the record has been updated already
    END;
    

    the trigger to auto update the version number would look a little like this

    CREATE OR REPLACE TRIGGER t1_version
    AFTER INSERT OR UPDATE ON t1
    FOR EACH ROW
    BEGIN
        IF :new.version_no IS NULL THEN
           :new.version_no  := 0;
        ELSE
           :new.version_no  := :old.version_no  + 1;
        END IF;
    END;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this scenario. I have my own website, that I use as my identifier,
i have this scenario where im loading images using a for loop: for (var
I have this scenario: This two clases with this attributes: Table [Id, Name, Parent_Id]
I have been given a task that can be simplified to this scenario: Customers
I have this scenario where I need data integrity in the physical database. For
we have this scenario: A server which contains needed data and client component which
I have this typical scenario. I have a smartclient application built on .net 2.0
Imagine this scenario: You have a desktop and a laptop. The desktop has a
Consider this scenario. I have an object, lets call it.... Foo. Foo raises a
The architecture for this scenario is as follows: I have a table of items

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.