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