optimistic-locking

Any support for optimistic locking in CakePHP?

I'm just starting out with CakePHP, and I can't find any support for implementing an optimistic locking scheme. The closest I could find was a comment on this CakePHP blog post saying that it wasn't supported in June 2008. Does anyone know if that has changed, or if someone has published an extension or a tutorial on how to implement it...

Why does activerecord optimistic locking work only once per row?

Somehow, I always get these on Fridays. My earlier question was regarding the same problem, but I can now narrow things down a bit: I've been playing with this all day, trying to make sense of it. I have a table with a lock_version colum, specified thus: add_column :jobs, :lock_version, :integer, :default=>0 And I do something like...

linq datacontext GetModifiedMembers in Attach scenario

I am trying to implement Optimistic Locking in an asp.net MVC application, as well as provide audit trailing. The audit framework relies on being able to call DataContext.GetModifiedMembers during SubmitChanges, which makes good sense, i guess. The optimistic locking uses ROWVERSION timestamps, serialized to base64 and put in a hidden ...

Input on how to keep object map in sync between browser (javascript) and server (asp.net web service/database)?

I have a object map on my server (objects representing Customers, Orders, Items, related to each other, based on content from a database) and want to keep an up to date version of that object map in the browser where the user is manipulating and viewing the data. Since more users can access and modify the same object map at the same tim...

Tips for Migrating from XPO to LINQ to SQL

I'm a long-time user of the DevExpress XPO library. It has many great features, but there are a few weaknesses: When saving an existing object, all properties are sent in an update query; changes are tracked on a per-object basis, not per-property. Optimistic locking is done on a per-object basis, rather than per-column. When an optim...

Can Hibernate's @Version consider changes in related entities?

Hi! I have 2 entities: Parent and Child in a one-to-many relationship. The Parent is versioned, i.e. has a @Version field. My goal is to synchronize changes to both Parent and Child entities on the Parent's version. E.g. one thread updates the Parent and another one updates one of it's Childs, this should cause an OptimisticLockExcepti...

How to use the Hibernate optimistic locking version property on the front end?

Optimistic locking using the version attribute for an entity works fine and is easy to implement: <version property="VERSION" type="int" column="EX_VERSION" /> The entity has a property of the following type: private int VERSION; public int getVERSION() { return VERSION; } public void setVERSION(int VERSION) { this.VERSION = VERSION;...

Can I add a condition to CakePHP's update statement?

Since there doesn't seem to be any support for optimistic locking in CakePHP, I'm taking a stab at building a behaviour that implements it. After a little research into behaviours, I think I could run a query in the beforeSave event to check that the version field hasn't changed. However, I'd rather implement the check by changing the ...

What is the best Clustering or Distributed System solution for Java applications

What are the best approaches to clustering/distributing a Java server application ? I'm looking for an approach that allows you to scale horizontally by adding more application servers, and more database servers. What technologies (software engineering techniques or specific technologies) would you suggest to approach this type of pro...

Grails optimistic locking strange behaviour

I've been trying to make GORM throw an optimistic locking error in an integration test. It has been said before that it is not possible to test for concurrent update errors without resorting to multiple threads, but even so I find the behaviour of my test case surprising: void testOptimisticLocking() { new Widget(foo:"bar").save(flus...

Defines JPA behavior for setting same value again?

I wonder, if there is any definition by JPA for the behavior, if you setting equals value for any property. I didn't find any words in the specification. I've tested with TopLink Essentials and Hibernate, what happens if I load a entity from database and set the property with same value again. @Entity public class MyEntity { @Id @G...

NHibernate overwrite the concurrency in optimistic scenario

Hi I have implemented optimistic locking for concurrency situations. I have used the version property in the mapping files to link to a integer. My aim is that if a user tried to save an out-of-date object, she will be given the option to overwrite changes. I have easily managed to get the SaveOrUpdate to throw an exception, but how...

How should I handle persistence in a Java MUD? OptimisticLockException handling

I'm re-implementing a old BBS MUD game in Java with permission from the original developers. Currently I'm using Java EE 6 with EJB Session facades for the game logic and JPA for the persistence. A big reason I picked session beans is JTA. I'm more experienced with web apps in which if you get an OptimisticLockException you just catch i...

Fluent NHibernate OptimisticLock.None() causes "The string 'none' is not a valid Boolean value."

I'm using the following mapping: public class LoadMap : IAutoMappingOverride<Load> { public void Override(AutoMapping<Load> mapping) { mapping.HasMany(x => x.Bids).OptimisticLock.None(); mapping.Version(x => x.Version); } } But when I try to create the session I get the following exception: [FormatException...

GAE update different fields of the same entity

Hi, UserA and UserB are changing objectA.filedA objectA.filedB respectively and at the same time. Because they are not changing the same field one might think that there are no overlaps. Is that true? or the implementation of pm.makePersistnace() actually override the whole object... good to know... ...

NHibernate mapping with optimistic-lock="version" and dynamic-update="true" is generating invalid update statement

I have an entity "Group" with an assigned ID which is added to an aggregate in order to persist it. This causes an issue because NHibernate can't tell if it is new or existing. To remedy this issue, I changed the mapping to make the Group entity use optimistic locking on a sql timestamp version column. This caused a new issue. Group has ...

Castle ActiveRecord optimistic locking on properties

Can Castle ActiveRecord do optimistic locking on properties? I found optimistic locking for the entire class, but not for an individual property. In my case, I need to make it so that adding/removing elements in a collection does not update the version number of the entity (so for example, adding a Product to a Store without changing any...

jdbctemplate and optimistic locking

In the project I'm in Hibernate and Spring jdbctemplate are mixed. I added optimistic locking. Hibernate works great with versioning but now I have to tansform all this jdbctemplate code to use versioning too. Is there something like LockingJdbcTemplate (like SimpleJdbcTemplate)? I was thinking I could implement a generic update metho...

optimistic locking batch update

How to use optimistic locking with batch updates? I am using SimpleJdbcTemplate and for single row I can build update sql that increments version column value and includes version in WHERE clause. Unfortunately te result int[] updated = simpleJdbcTemplate.batchUpdate does not contain rowcounts when using oracle driver. All elements are...

What happens if two people submit edits at once

Hi there, This might be a stupid questions but I wanted to know what happens if two users edit some data at once and then both click submit at the same time, I assumed Rails handled requests one after the other and so someone would get an error message but is this correct? Thanks Once one person has edited data I dont want it to be ac...