I'm using NHibernate HiLo as my identity generator. I currently have a sepperate table in my database for each of my entity tables. For example I have Customer and CustomerKey table, each with a NextHiLo column.
What would be a great thing to have is a single table that holds key for all the others. Idealy would be if i could have a table like this:
TableName | NextHiLo
Customer | 19
Invoice | 5
Receipt | 3
If that isnt't possible with NHibernate, the next best thing would be:
CustomerHiLo | InvoiceHiLo | ReceiptHiLo
19 | 5 | 3
Is any of the two options above posible to achieve - the schema generation script produced by NHibernate doesn't apear to support any of them?
Have you tried using the where property of the hilo generator? Something like:
<class name="Customer">
<id name="Id">
<generator class="hilo">
<param name="where">TableName = 'Customer'</param>
...
</generator>
</id>
...
</class>
I have written about this here: http://daniel.wertheim.se/2011/03/08/nhibernate-custom-id-generator/
there is a patch for adding this on JIRA, but I don't know when it will be in the trunk https://nhibernate.jira.com/browse/NH-1374
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With