I am developing a hotel booking site. It is a J2EE 1.4 web application and using JSP and JDBC.
I have one method which is responsible to book the hotel rooms.
booking()
And from this method I am calling other four methods
bookRooms()
makePayment()
confirmUserByMail()
confirmUserBySMS()
I am aware that two users can try to book the same room at the same time and in my current system it is possible that two users might end up with the same room.
How should I handle the transaction to avoid this concurrency issue?
It might be very common scenario but I never handled this kind of scenario before, so please guide me.