Hi, I have an app where users make reservations. When 2 or 5 or 6 people apply for a 1-person quota at the same time (they press the registration button at the same time), it registers them both. However, it shouldn't have allowed this. In fact, they do not even need to press the button at the same time, it accepts the reservation of both of them even if there is a 2-3 second difference. I asked the same question once but couldn't find an answer that would solve my problem. So, how can I solve this problem? Dozens of people have developed financial applications where they can buy and sell in less than a second. How do they handle this?
What is your association between Reservation and people entity?
If in all the scnerio every reservation will only have 1 person then create an association 1-1 between both the entities.
By implementing above solution your problem automatically resolved.