title: Best way to lock entities between clients
body: <p>We are re-writing an old Cobol application in Java EE.
  The old Cobol is a full client application.</p>
  
  <p>The client's requirement is to lock entities (e.g. a particular account) so that no one can access it or at least only in read-only. This is because some transactions might be long and we don't want users to enter a lot of data just to loose everything while updating.
  Optimistic locking is not wanted.</p>
  
  <p>Currently the requirement is implemented by creating locks in a file system with a lot of problems like concurrent access, no transactions. Not very Java EE compliant.
  The lock should also tell the client that is locking an entity.</p>
  
  <p>Any suggestion?</p>