Concurrent updates handling in hibernate

前端 未结 4 1913
陌清茗
陌清茗 2020-12-04 16:36

Presently we are using JDBC in the data layer and planning to replace it with hibernate. I am new to Hibernate and not sure how hibernate handles concurrency. Can somebody e

4条回答
  •  情深已故
    2020-12-04 17:19

    There are JPA implementations like objectDB in which optimistic locking is activated by default and user don't need to maintain version variable in database table as, it is internally taken care by objectDB. Optimistic locking is good where updates are not frequent and where locking have implicit costs like in e-commerce where locking means loss of business. Pessimistic locking is ideal where concurrency is not much demanded and transaction is finished quickly to free up the resource.

提交回复
热议问题