title: concurrency with h2 database
body: <p>I have a table xxx  with id (id_xxx int AUTO_INCREMENT ) and name (name_xxx varchar (50)),
  When I insert a new row in the table I made​​:</p>
  
  <pre><code>INSERT INTO xxx VALUES ​​("name for test");
  </code></pre>
  
  <p>and the result (int=1) of insertion is returned, then I display in my java interface a message "succseed!", until now it's a very basic and simple operation...
  BUT,
  when I want to return the inserted id_xxx,I have to do another query to the database:</p>
  
  <pre><code>INSERT INTO xxx VALUES ​​("name for test");
  //after the insert response I made:
  SELECT MAX (id_xxx) FROM xxx;
  </code></pre>
  
  <p>and I display in my java interface "succseed $$$ is your id_xxx  "....</p>
  
  <p>the second version can easily cause a serious error during concurrent access to multiple users:
  imagine a case when a user1 makes an insert... and then H2DB interrupt operations of this user then executes the insert of user2.
  when user1 executes a select max (id_xxx) the H2DB return A FALSE id_xxx...</p>
  
  <p>(I hope that my example is clear otherwise I will schematize this problem).</p>
  
  <p>how to solve this problem?</p>