<AutoIncrement> Element

Sets the identity strategy of the enclosing element to use the auto-increment feature of the underlying relational database system.

<PersistentField [fieldName="fieldName"]>

       <AutoIncrement [value="enabled"]>



<PersistentField [fieldName="fieldName"]



enabled: If set to true, the field is initialised with a server-side generated numeric value.


·    The mapped property must be of an integer type.

·    This mapping feature can only be applied to read only properties (i.e. can only have a getter).



<Type name="AutoIncrementedSample">





  <Member name="Id"><PersistentField AutoIncrement="true"/></Member>




Editions:Professional, Evaluation, Express

Database Platforms:Microsoft SQL Server 2000, Microsoft SQL Server 2005, IBM DB2

See Also

<PersistentField> Element | Object Identity Generation Strategies

Object Identity Generation Strategies <Sequence> Element