title: JPA PessimisticLockScope.NORMAL and locking "relationships"
body: <p>I am studying JPA Documentation and encountered the following lines:</p>
  
  <blockquote>
    <p>Entity relationships for which the locked entity contains the foreign
    key will also be locked, but not the state of the referenced entities
    (unless those entities are explicitly locked). Element collections and
    relationships for which the entity does not contain the foreign key
    (such as relationships that are mapped to join tables or
    unidirectional one-to-many relationships for which the target entity
    contains the foreign key) will not be locked by default.</p>
  </blockquote>
  
  <p>it's from <a href="http://docs.oracle.com/javaee/6/api/javax/persistence/PessimisticLockScope.html#NORMAL" rel="nofollow noreferrer">here</a> (<code>PessimisticLockScope.NORMAL</code>)</p>
  
  <p>I wonder how to interpret these lines. If <code>PessimisticLockScope</code> is set to <code>EXTENDED</code> then rows in join tables are also locked (but not related entities themselves), so when using <code>NORMAL</code> value what will be locked? For sure entity row (or rows if inheritance strategy is <code>JOINED</code> or <code>TABLE_PER_CLASS</code> or if has a <code>SecondaryTable</code>), but what means "entity relationships":</p>
  
  <blockquote>
    <p>Entity relationships for which the locked entity contains the foreign
    key will also be locked</p>
  </blockquote>
  
  <p>in the context of <code>PessimisticLockScope.NORMAL</code>?</p>