select for update in hibernate

Transaction transaction = session.beginTransaction();
Country country = (Country) session.get(Country.class, id, LockMode.UPGRADE);
country.setName(“India”);
transaction.commit();

==================================================================

OR

 

criteria.SetLockMode(LockMode.UpgradeNoWait);

引文来源  simulating select for update in hibernate. (Object Relational Mapping forum at JavaRanch)