Locking a table not working?

I have this code in my program, this code is suppose to prevent two or
more users to update sequence table at the same time but it is not

I tried this code using ruby only and it works really well but not in
jruby why is that happening.

I use mysql as my database

Sequence.transaction do

sq = Sequence.find_by_sequence_key(“bus2015”, :lock => true)
if !sq.nil?
new_val = busmst.business_account_no.split("-")
new_seq = new_val[2].to_i
new_seq += 1
sq.sequence_value = new_seq


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs