I implemented optimistic locking for REST resources that have a 1 to 1 mapping to the database tables, passing back the version number that was in the GET, back to the PUT call. If the version number changed in the database between the time I did GET and PUT, an optimistic blocking exception occurred. Pretty simple design.
Now, how do I do the same for composite REST resources that map to multiple database tables? I would not have to skip several version fields (one for each data table related to a composite resource). A simple example of a compound resource would be / FooBar, where / Foo and / Bar are non-composite resources.
Basically I am looking for an example of REST implementation of the Fowler Coarse Grained Locking pattern: http://martinfowler.com/eaaCatalog/coarseGrainedLock.html
Bestractices
source share