Hi all,
I had trouble adding a record to a table using a MSSQLSERVER2005. It generated the above error.
This was my hbm.xml code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="BusinessLogic.MediumType, BusinessLogic" table="TypeOfMedium">
<id name="TypeOfMediumID" column="TypeOfMediumID" type="Int32" unsaved-value="0">
<generator class="Identity"/>
</id>
<property name="Code" column="TypeOfMediumCode"/>
<property name="Description" column="TypeOfMediumDesc"/>
</class>
</hibernate-mapping>
It didn't work. Then I changed it to:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="BusinessLogic.MediumType, BusinessLogic" table="TypeOfMedium">
<id name="TypeOfMediumID" column="TypeOfMediumID" type="Int32" unsaved-value="0">
<generator class="identity"/>
</id>
<property name="Code" column="TypeOfMediumCode"/>
<property name="Description" column="TypeOfMediumDesc"/>
</class>
</hibernate-mapping>
and now it works just fine. Notice that I changed "Identity" to "identity".
Greetings
Dirk Van hoof
|