Simple Identifier Mapping

When a primary key is attached to a single column, only one attribute in the primary identifier can be mapped. This kind of primary key can be generated automatically. You can define the generator class and parameters. There are many generator class types, such as increment, identity, sequence, etc. Each type of generator class may have parameters that are meaningful to it. See your NHibernate documentation for detailed information.

You can define the generator class and parameters in the NHibernate tab of the primary identifier property sheet. The parameters take the form of param1=value1; param2=value2.



  1. Open the class property sheet and click the Identifiers tab. Double-click the entry to open its property sheet.
  2. Click the NHibernate tab, select a generator class and define its parameters.

    Example parameters:

    • Select hilo in the Generator class list

    • Enter "table=hi_value,column=next_value,max_lo=10000" in the Generator params box. You should use commas to separate the parameters.

  3. You can check the code in the Preview tab:


Note that, if there are several Primary identifier attributes, the generator is not used.