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
working.
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
sq.save
end
end