Search code examples
nhibernateidentifier

How to implement using NHibernate UInt64 identifier generator with the option to set its initialize value


Is it possible to use NHibernate for getting unique identifier of type: UInt64. The initialize value of this property must be unique (for more than 1 DB). The usage: I need to get this value and increment it by 1. This action should be a closed transaction.


Solution

  • usually we want to have unique keys in one DB, not for multiple databases, GUIDs are used there as far as I know. Getting the max(int64) out of both DBs and then picking the largests and adding 1 will work but that sounds rather clumsy I think? What do you need this for actually?

    Hope this helps,