# Optimistic locking pitfalls

DevFeed: [Optimistic locking pitfalls](<https://devfeed.tech/articles/optimistic-locking-pitfalls-27269.md>)

Original publisher: [Read original article](<https://blog.pchudzik.com/201704/optimistic-locking/>)

Published: 2017-04-27T00:00:00Z

Content type: tutorial

Language: en

Sources: [Paweł Chudzik](<https://devfeed.tech/sources/pawe-chudzik.md>)

Topics: [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Transactions](<https://devfeed.tech/topics/transactions.md>), [.NET 11 Preview 7](<https://devfeed.tech/topics/net-11-preview-7.md>)

Tags: [concurrency-control](<https://devfeed.tech/tags/concurrency-control.md>), [consistency](<https://devfeed.tech/tags/consistency.md>), [hibernate](<https://devfeed.tech/tags/hibernate.md>), [java](<https://devfeed.tech/tags/java.md>), [jpa](<https://devfeed.tech/tags/jpa.md>), [locking](<https://devfeed.tech/tags/locking.md>), [optimistic-locking](<https://devfeed.tech/tags/optimistic-locking.md>), [pitfalls](<https://devfeed.tech/tags/pitfalls.md>), [transactions](<https://devfeed.tech/tags/transactions.md>)

## AI overview

This article explains optimistic locking as a concurrency-control technique and examines how plain SQL and JPA/Hibernate version checks prevent one user from unintentionally overwriting another user's changes.

## Source excerpt

Optimistic locking is concurrency control method that allows to execute multiple transactions simultaneously as long as they don't interfere which each other. That's definition from wikipedia. You probably already know that Hibernate supports optimistic locking and all you have to do in order to implement optimistic locking in you app is to add @Version on number or timestamp field and you are good to go. Right? Read more