From: Doug C. <de...@fl...> - 2002-03-03 17:04:37
|
In my experience, when people say "optimistic locking" they can mean many different things. My earliest exposure (70s) to the term was in OS design where pessimistic locks aborted on contention, and optimistic locks waited. It seems to have taken on slightly different meanings in the RDB (SQL) and ODB worlds as well, as Gavin's and Paul's definitions highlight. Anyway, I have seem other O/R tools and ODBs call the technique Gavin is describing (no lock, check version number on update) "long duration transactions" and "optimistic locking." > * a global property for the database ie. hibernate.select_for_update=true > * on a class-by-class basis in the mapping file > * as a property of the individual session ie. Session.setSelectForUpdate All too gross. > * as part of the query language ie. SELECT foo FROM CLASS f.Foo FOR UPDATE > * as part of the API ie. session.loadForUpdate(fooID) These two are good. The dialect could have a new property to indicate its support for this feature. If not available, ignore it. e |