Hi,
I have a database with an column „OrganizationalUnitId“ (primary key), which is set to Identity column in the database and is therefore auto assigned. What do I have to do in order to insert another row to the table?
The hbm.xml-file is:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="x.y.z.Person, x.y" table="OrganizationalUnit">
<id name="ObjectId" column="OrganizationalUnitId" type="Int32">
<generator class="assigned" />
</id>
<property name="TypeId" column="OrganizationalUnitTypeID" type="Int32"/>
<property name="StatusId" column="OrganizationalUnitStatusID" type="Int32"/>
</class>
</hibernate-mapping>
It complains that no explicit value can be inserted in the coulumn as long as Identity_insert iss et to Off.
How do I have to configure the file and how do I have to write tth code to add a row to Table with Identity Column?
How can I set Identity_insert either in the code or in hbm.xml file to ON? Or even better how can insert data without inserting the Identity Column?
Thanks in advance
antoschka
|