title: Hibernate GUID local generator
body: <p>I use hibernate to generate ids for my MySQL data-tables:</p>
  
  <pre><code>&lt;class name="XXXX" table="XXXX"&gt;
      &lt;id name="Id" column="Id" type="string"&gt;
          &lt;generator class="guid"/&gt;
      &lt;/id&gt;
  ....
  &lt;/class&gt;
  </code></pre>
  
  <p>it works fine.</p>
  
  <p>however, when i profiling the sql queried, there are 2 sqls for 1 insert:</p>
  
  <p>1).select uuid() and then 2).insert ....</p>
  
  <p>I have 3 questions:</p>
  
  <ol>
  <li>why not hibernate generates the "GUID"s locally?</li>
  <li>how much is the overhead for "select uuid()" than "UUID.randomUUID()" for one insert?</li>
  <li>can i config a "local" generator in hibernate?</li>
  </ol>