I have a POJO mapped to a table (one primary key) and everytime I do an update to a row of that table I want to do a "select for update" effectively locking other people from concurrently making the update. Is there a hibernate 2.0 mapping attribute I can use?
Probably you have use LockMode feature of Hibernate.
Transaction transaction = session.beginTransaction(); Country country = (Country) session.get(Country.class, id, LockMode.UPGRADE); cat.setName("India"); transaction.commit();
Country will be loaded into session using a SELECT FOR UPDATE, thus locking the retrieved rows in the database until they�re released when the transaction ends.