NHibernate HiLo - new column per entity and HiLo catches

Posted by Gareth on Stack Overflow See other posts from Stack Overflow or by Gareth
Published on 2009-08-28T08:42:13Z Indexed on 2010/03/14 7:05 UTC
Read the original article Hit count: 959

Im 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 im doing wrong.

Thanks

© Stack Overflow or respective owner

Related posts about nhibernate-mapping

Related posts about nhibernate