Hi
I have following *newbie* question:
I am creating a "work-task"-table which records task to be
processed. The idea is that multiple users are working on
these tasks and are able to "check out" a set of tasks which
they want to process, e.g. the 10 last entered tasks.
Thus, my table requires an id for each task, a timestamp field,
other field related to the work to do and an indicator field
which tells, that a task is currently in process at an user.
My question is now related to concurrency in the application.
What is the best way to avoid problems? Where do I have to
pay attention? If I select a set of appropiate tasks (e.g. the
oldest non-processed tasks) and then want to update the
"in-work" field, I can not be sure, that not another user
has meanwhile also selected one of my task...
Transactions give my the possiblity to be sure that multiple
database queries have been completed successfully (and rolled
back in case of an error), but don't prevent other users to
access certain records...is this correct?
I know certain DBs allow SELECT FOR UPDATE which actually seems
to me a solution, but I think, I simply have not understand
the whole transaction stuff correctly or the versioning mechanism
existing in Hibernate.
Does anyhave have some advice for me?
Thanks a lot!
|