The locking API looks fine to me, although I'm no expert on locking
strategies.
One thing which did occur to me: might it make sense to have either a
session-wide and/or transaction-wide locking setting, e.g. to support
something like:
session.setLockMode( LockMode.NONE );
...that affects all objects subsequently loaded in the session or
transaction. Or is there an equivalent to this already?
Also, just out of curiosity, is there any support for implementing
pessimistic locking for databases that don't support it directly? E.g. one
lo-tech way is to require a "locked" column in the table in question, which
is set to true to lock the record, and reset when the record is updated and
the lock released. I'm not suggesting that Hibernate should implement this
necessarily, but it might be nice to have the ability to plug in that type
of behavior, or an alternative, if it's needed in a particular application.
Not sure if this qualifies as GonnaNeedIt. One application where I saw this
used was for a document manager, where the lock could potentially persist
over quite some time, including e.g. through a database restart. Perhaps
this is out of scope here, though - that kind of thing can easily be
implemented as a layer above Hibernate, although having it integratable
might be neat.
Anton
|