optimistic-locking

How do I avoid a race condition in my Rails app?

Hi, I have a really simple Rails application that allows users to register their attendance on a set of courses. The ActiveRecord models are as follows: class Course < ActiveRecord::Base has_many :scheduled_runs ... end class ScheduledRun < ActiveRecord::Base belongs_to :course has_many :attendances has_many :attendees, :thr...

ActiveRecord::Base.connection.update(sql) sometimes returns incorrent number of affected rows

I have a production web site with the following environment: Rails 2.3.5 MySQL Server 5.1.33 Enterprise Ruby 1.8.6 (2008-08-11 patchlevel 287) [x86_64-linux] mysql gem 2.7 Old version of BackgrounDRb plugin running on 4 different servers for background tasks, with 5 different workers each (Ruby threads, not separate processes!). One ...

Spring Optimistic Locking:How to retry transactional method till commit is successful

Hi, I use Spring 2.5 and Hibernate JPA implementation with Java and "container" managed Transactions. I have a "after user commit" method that updates data in background and need to be committed regardless of ConcurrencyFailureException or StaleObjectStateException exception, because it will never be shown to client. In other words, ne...

Fluent Nhibernate configuring OptimistickLock.Dirty() with Transaction.IsolationLevel.ReadCommited when the row locked in Oracle 10g

The problem is : I have a working system with FluentNhibernate. I have a legacy database and it's hybrid system which suppose to give an answer to a new and old systems as one. So that means I couldn't use the Version - which means at this point to change the schema and add column to each table. I've added OptimistickLock.Dirty() with ...

Server-side optimistic locking in a ReSTful app: handling asynchronous requests from the same client

I am working on a project that is in transition from proof-of-concept to something worthy of a pilot project. One of the key improvements for this phase of development is to move away from the current "persistence" mechanism, which uses a hash table held in memory and periodically dumped to a file, to a more traditional database back-end...

how to raise OptimisticLockException

Unable to catch optimistic lock exception. one way to raise OptimisticLockException is by using em.flush() try{ //some enitity em.flush() } catch(OptimisticLockException ole){} but i dont think this is best solution beacuse in this full database is flush. another work around is by catching EJBException and find RollBackExce...

Does it make sense to use QueuedPessimisticEJBLock and optimistic-locking simultaneously?

I'm working on a J2EE application where the EntityBeans (EJB 2.1) are using the container configuration "Standard CMP 2.x EntityBean" which uses the locking-policy QueuedPessimisticEJBLock: <container-configuration> <container-name>Standard CMP 2.x EntityBean</container-name> ... <locking-policy>org.jboss.ejb.plu...