Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Friday, March 25, 2011

Optimistic or Pessimistic Locking for ADF 11g Web Applications?

You would be knowing that ADF supports both type of locking mechanisms for ADF web applications. By default the locking mode is set to pessimistic. However, the recommended mode for web applications is Optimistic for performance reasons.

The reason is pessimistic lock creates pending transactional states in the database in the from of row level locks. And if in the background an application module recycling will happen it will call a rollback on the associated jdbc connection thus, causing all the locks to be released. This will cause unexpected behavior for pessimistic locking mode.

On the other hand, with optimistic locking as soon as page will terminate associated AM will be released immediately and without any burden of possible database level locks.

Andrejus has explain with a demo app the difference on these here

No comments: