nhibernatenhibernate-mappinghilo

NHibernate HiLo - new column per entity and HiLo catches


I'm currently using the hilo id generator for my classes but have just been using the minimal of settings eg


<class name="ClassA">
    <id name="Id" column="id" unsaved-value="0">
      <generator class="hilo" />
    </id>
...

But should I really be specifying a new column for NHibernate to use foreach entity and providing it with a max lo?


<class name="ClassA">
    <id name="Id" column="id" unsaved-value="0">
      <generator class="hilo">
        <param name="table">hibernate_unique_key</param>
        <param name="column">classA_nexthi</param>
        <param name="max_lo">20</param>
      </generator>
    </id>
...
<class name="ClassB">
    <id name="Id" column="id" unsaved-value="0">
      <generator class="hilo">
        <param name="table">hibernate_unique_key</param>
        <param name="column">classB_nexthi</param>
        <param name="max_lo">20</param>
      </generator>
    </id>
...

Also I've noticed that when I do the above the SchemaExport will not create all the columns - only classB_nexthi, is there something else I'm doing wrong.


Solution

  • I asked this question again but in the nhusers group, see here for response i got