Identifier generation

We have seen that generator was specified while mapping the identifier. The generator attribute is used to declare the algorithm to be used to generate an identifier value. Value used in the generator attribute is either the short name of algorithm that NHibernate provides out-of-the-box or the assembly qualified name of the NHibernate class that implements the said algorithm. NHibernate has implemented several such algorithms which should fit any identifier generation requirement. But if you are not happy with these then you can build your own algorithm by implementing interface NHibernate.Id.IIdentifierGenerator.

Let's take a look at important identifier generation algorithms that NHibernate offers out-of-the-box.

Identity ...

Get Learning NHibernate 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.