In version of Hibernate 5.3.7, it was possible to have the following case inside a single transaction:
Employee e = entityManager.find(Employee.class, THE_KEY_HERE);
... many more action on different entities
And at the end, when the transaction is committed, the Employee was saved, and his version automatically bumped.
Since we upgraded to 5.3.11, the employee version is not bumped. If we remove the entityManager.clear() the lock is working.
But in my opinion clearing the persistence context for any reason shouldn't impact the lock mechanism.
From what I found this is related to this issue https://hibernate.atlassian.net/browse/HHH-13492.