How do you interpret "exclusive lock". Why it has to be exactly PESSIMISTIC_WRITE? Could it be PESSIMISTIC_FORCE_INCREMENT?As per section 184.108.40.206: When an application locks an entity with LockModeType.PESSIMISTIC_READ and later updates that entity, the lock must be converted to an exclusive lock when the entity is flushed to the database.
- Posts: 185
- Joined: Mon Jun 20, 2016 5:06 pm
- Site Admin
- Posts: 8910
- Joined: Fri Sep 10, 2010 9:26 pm
- Posts: 358
- Joined: Fri Nov 29, 2013 8:26 pm
I think we can modify this statement by adding " ...without blocking other transactions reading the data which was committed in a previous transaction."
When one transaction gets the pessimistic read lock, other transactions can read the entity's data in the database, but not the pending changes in the persistence context. After the transaction commits the changes to the database, other transactions need to refresh the entity.
Users browsing this forum: No registered users and 2 guests