The locks are stored in memory for performance and to keep the operation atomic. You could model an additional entity in the domain model to store the locks, and adjust the Java accordingly (shouldn't be to hard).
Disadvantages of this approach are a small performance hit, and that locks cannot be guaranteed (although the chances will be very small that two persons will get the lock at the same time, they have to obtain the lock in about the same millisec).