Thursday, 29 August 2013

Database operation in one go (one transcation)

Database operation in one go (one transcation)

I am working on a driver-booking management system. What I want to do is
that I need to add a driver in booking table (which means assigning a
booking to driver). Before that I need to check whether or not booking
record has driver record associated with or not (booking is assigned or
not), If yes then do nothing.
It works fine with one user doing this. But issue comes with multiple
users doing this on same record, same time.
How to handle this situation. I know about @transactional annotation. Is
that the right solution? Should I apply this on single method rather than
on my booking Assigning Service?
Using sync block would slow down processing alot, so currently I am
against this option

No comments:

Post a Comment