How does LockModeType.OPTIMISTIC work in JPA and Hibernate

Explicit optimistic locking

In my previous post, I introduced the basic concepts of Java Persistence locking.

The implicit locking mechanism prevents lost updates and it’s suitable for entities that we can actively modify. While implicit optimistic locking is a widespread technique, few happen to understand the inner workings of explicit optimistic lock mode.

Explicit optimistic locking may prevent data integrity anomalies when the locked entities are always modified by some external mechanism.

Continue reading “How does LockModeType.OPTIMISTIC work in JPA and Hibernate”


How to get a 10,000 points StackOverflow reputation

How it all started

In spring 2014, I initiated the Hibernate Master Class project, focusing on best practices and well-established usage patterns. I then realized that all my previous Hibernate experience wouldn’t be enough for this task. I needed more than that.

Hibernate has a very steep learning curve and tens of new StackOverflow questions are being asked on a daily basis. With so many problems waiting to be solved, I came to realize this was a great opportunity to prove my current skills while learning some new tricks.

On 8th of May 2014, I gave my very first StackOverflow answer. After 253 days, on 16th of January 2015, I managed to get a reputation of over 10,000:


Continue reading “How to get a 10,000 points StackOverflow reputation”

A beginner’s guide to Java Persistence locking

Implicit locking

In concurrency theory, locking is used for protecting mutable shared data against hazardous data integrity anomalies. Because lock management is a very complex problem, most applications rely on their data provider implicit locking techniques.

Delegating the whole locking responsibility to the database system can both simplify application development and prevent concurrency issues, such as deadlocking. Deadlocks can still occur, but the database can detect and take safety measures (arbitrarily releasing one of the two competing locks).

Continue reading “A beginner’s guide to Java Persistence locking”

Why you should pay developers to learn

A true story

We were having a meeting with a customer and he had just presented a project idea. He wanted us to give him a draft system architecture, supporting his project technical requirements. At one point, I was telling him that incremental development requires architecture evolution as well.

When I said that finding the right architecture is also a learning process, he cut me off short with the following sentence:

Do you expect me to pay you to learn?

To save the day, I told him I was referring to the business domain, we needed to fully understand in order to provide the right architecture.

Continue reading “Why you should pay developers to learn”

Book review – How Linux Works 2nd edition

O’Reilly Reader Review Program

I heard about O’Reilly Reader Review Program after reading Thorben Janssen’s Java Performance: The Definitive Guide book review. After being admitted, I got a copy of How Linux Works, 2nd Edition. The book is great for anybody working in this field and you should totally read it. Next I’m going to tell you why.

Continue reading “Book review – How Linux Works 2nd edition”