If you set the connection isolation mode to Serializable, then most databases will acquire a read lock over the range of the values that you are querying over. That way, if you query again, you receive exactly the same set of values.
So, if the data is not there, no-one else will be permitted to commit a transaction that puts it there whilst your transaction is active.
Note that although Serializable is strictly correct, you can end up locking a large portion of the database out from other people so make sure that the transaction is as tight as possible.
_________________ Paul Hatcher
NHibernate Team
|