Forum: JRuby Locking a table not working?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
53a67e0717e8dc3035951ad893485f5d?d=identicon&s=25 Nichole Soriano (endyeyes)
on 2015-06-05 08:44
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
This topic is locked and can not be replied to.