This issue is not caused by SAP. To solve this I had to reconfigure a way how the lock BAPI and subsequent BAPI which does another operation (update) for the employee is called in my JAVA app.
It must be always ensured both BAPIs are called using the same transaction.