title: Concurrently updating database table column value only once
body: <p>I have a Postgres table named <code>mytable</code> which I am using from JPA/Hibernate entity to manage it.</p>
  
  <p>The table has a column name <code>mycolumn</code> with default value set as FALSE.</p>
  
  <p>Now there will be many concurrent update to that column and I want only to update if and only if value is <code>FALSE</code>, and once it is updated to <code>TRUE</code> by any of one, no other concurrent requests must be able to update it, never ever, resulting in something like 'Value has been already updated and you can not update it.'</p>
  
  <p>AFAIK Locking is not going to help with this.</p>
  
  <p>How to handle this with JPA/Hibernate in concurrent situation?</p>
  
  <p>Thanks</p>
  
  <p><strong>Edit:</strong> revise title</p>