Actually you're right, lockedKeys should always be also added to affectedKeys - no need for any refactoring, it should happen now! The case were they are not added is just a bug: PessimisticLockingIntereceptor.visitLockControlCommand.