After I get some sleep ... and spend a little more in the morning, I think I figured out my problem. Thus, the lock is actually performed as part of the transaction. However, when I tested my code, I managed to get a locked string using the EntityManager.find method (class, key) (no locking strategy was specified). I mistakenly thought that by putting a lock on a string, the string could not be read. Period. However, I reread the definitions of JPA PESSIMISTIC_READ and PESSIMISTIC_WRITE and noticed my problem:
PESSIMISTIC_READ - , , PESSIMISTIC_WRITE.PESSIMISTIC_WRITE. , , PESSIMISTIC_READ PESSIMISTIC_WRITE.
, READ WRITE .