The transactions should start by locking the table rather than by lockingit after they have done a select.