setLockMode « Query « JPA Q&A

2. query.setLockMode()

Session.lock() performs a version number check if the specified lock mode is READ, UPGRADE or UPGRADE_NOWAIT. (In the case of UPGRADE or UPGRADE_NOWAIT, SELECT ... FOR UPDATE is used.) If the database does not support the requested lock mode, Hibernate will use an appropriate alternate mode (instead of throwing an exception). This ensures that applications will be portable.

3. Criteria with setMaxResults & setLockMode wrong SQL stmt

Newbie Joined: Wed May 04, 2005 5:49 am Posts: 2 Hibernate version: 2.1.8 Mapping documents: Code:

4. CreateQuery & setLockMode

Hi, I'm implementing a DAO method to retrieve the next id in a column using pessimistic blocking, so I'm sure that anyone else uses the same number (what would derivate in a primary key violation). My code is: Integer maximo = null; Query query = session .createQuery( "select max(padre.bloqueo)+1 from PadreVO padre") .setLockMode("padre", LockMode.UPGRADE_NOWAIT); while (true) { try { maximo = ...

5. query setLockMode function

Hi, I just want to clear something. In sybase there is something "at isolation read uncommitted" you can use when executing a query to read pages even if locked. While searching in hibernate for sucha behavior ,I have came accross "query.setLockMode(alias??? ,LockMode.NONE)" What I need to find out is how to specify the alias for mulitple objects+the function i query with ...

6. query.setlockmode()

I would like to know how this behaves when the alias given to setlockmode() is a joined subclass. e.g. query.setlockmode("subclassalias", LockMode.UPGRADE). In a hibernate named select query in my testing, this ends up adding a "for update of.." in the SQL, but only on the DB table that corresponds to the superclass. it doesnt apply the lock to any of the ...