1. 程式人生 > >Hibernate主鍵生成策略之Hilo

Hibernate主鍵生成策略之Hilo

使用hilo生成策略,要在資料庫中建立一張額外的表,預設表名為hibernate_unique_key,預設欄位為integer型別,名稱是next_hi

我們也可以自己設定自定義的表名和欄位名

<id name="id" type="integer">
   <column name="id"/>
   <generator class="hilo">
      <param name="my_unique_key/>
      <param column="next_hi_vcalue"/>
   </generator>
</id>