title: delphi xe7 firedac locking on mssql server
body: <p>I have got some strange problem withe FireDAC and locking on mssql-server and have no idea how this can happen. So I hope anybody has some experience and will help me :)</p>
  
  <p>We have got the following situation:
  In our application we have got a table <em>ToDo</em> and a table <em>ToDoNotes</em>. Both have primary unique keys <strong>ID</strong> and they are linked via <em>ToDoNotes.ToDoID</em>. 
  Table <em>ToDo</em> is used to write down the next tasks and table <em>ToDoNotes</em> is to leave comments on each of the tasks. So several records in table <em>ToDoNotes</em> can be for one record in table <em>ToDo</em>. We connect to these mssql-tables using FireDac Table-Component <em>FDTable</em>. The connection has <code>lockmode pessimistic</code> with <code>locktpoint immediate</code>.</p>
  
  <p>The following steps are locking the complete table <em>ToDoNotes</em> and I do not know why:</p>
  
  <p><strong>Session one:</strong></p>
  
  <ol>
  <li>TblToDo.Edit for record 1</li>
  <li>TblToDoNotes.Append to append a record for TblToDo-record 1</li>
  </ol>
  
  <p>so both Tables are in <em>EditMode</em> now.</p>
  
  <p><strong>Session two:</strong></p>
  
  <ol>
  <li>TblToDoNotes.Append </li>
  </ol>
  
  <p>At this point the application (Session two) is freezing until, we do a <code>TblToDo.Post</code> or a <code>TblToDo.Cancel</code> in Session one. 
  In the Microsoft Managment Studio I can see session two with waittype <strong>LCK_M_S</strong> and resource <strong>ridlock</strong></p>
  
  <p>Has anyone an idea what is going wrong? If we append records to <em>TblToDoNotes</em> in two different sessions everything works fine. It seems to me that FireDAC creates a second transaction which blocks the whole table <em>ToDoNotes</em> if there is already one table in editmode or something like that.</p>
  
  <p>Every help is greatly appreciated.</p>
  
  <p>Markus</p>