I have declareted the fallowing Mapping for NHibernate:
<class name="Sales" table="Sales" lazy="false" >
<id name="Id" column="Id" type="Guid">
<generator class="assigned"/>
</id>
<version name="ObjectVersion" column="ObjectVersion"/>
<property name="Number" column="Subject" type="String" length="255" />
<property name="Text" column="Body" type="String" length="50" not-null="true" />
</class>
I should now add a additional Column called Key which is defined as an AutoIncrement-Column. Can someone give me a tip how I have to declare this column? This Column has not to be the primary-key - i need only a additional column which has a integer which count up for each record.
Thanks for your help.
Best Regards, Thomas
Are you using SQL Server? If yes, then just create an Identity column ALTER TABLE Sales ADD Key INTEGER Identity(1,1) Then map it as a normal property. It will not be the primary key but it will auto-increment.
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