SpringSource/spring-data-mongodb — pull request #11 by noter (2012-09-06 11:10:17+00:00)
Title: DATAMONGO-279 - optimistic locking based on version field

This pull request contains optimistic locking implementation based on version field.

Changes:

added Version annotation with points to a version field
change save method on MongoTemplet to detect first time save or update.
If first save occure ((isNew() == true) and entity contains version filed then set this field to 0 and perform normal save.
If update occure (isNew() == false) then perform update with query by id and version and inc(version filed by one), then check writeConcern.getN() and throw OptimisticLockingFailureException if no documents was updated.

Any comments will be welcome.