title: Basic question about optimistic lock (Hibernate)
body: <p>I am new to use "optimistic locking" mechanism - I am using hibernate (in Jboss) and Container Managed Transaction (CMT). 
  I want to handle the scenario when, between my <strong>entity-read</strong> and <strong>entity-update</strong> someone else updates the same entity (i.e. row) in DB.
  In such case I want to throw exception..</p>
  
  <p>I have annotated my entity with @Version - like</p>
  
  <pre><code>@Version
  private Long version;
  </code></pre>
  
  <p>Now, I am confused if this is enough for version management or I need to explicitly call
  the EntityManager.lock() api like</p>
  
  <pre><code>  {
      .
      .
      final QueryDTO queryDTO = entityManager.find(QueryDTO.class, id);
      entityManager.lock(queryDTO, LockModeType.READ);
      queryDTO.setStatus(updatedStatus);
      entityManager.persist(queryDTO);
    }
  </code></pre>
  
  <p>Thanks in advance,</p>