Hi,
This is first time I am using Nhibernet.
This is how I have defined my xml file
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false">
<class name="myVRM.DataLayer.vrmCustomAttributes, vrmDataLayer" table="Dept_CustomAttr_Option_D">
<id name="OptionID" column="OptionID" type="Int32" unsaved-value="0">
<generator class="identity" />
</id>
<!-- Map properties I'd like to persist/fetch, assume column = propery name, and type is determined by reflection -->
<property name="CustomAttributeID"/>
<property name="DeptID"/>
<property name="OptionType"/>
<property name="OptionID"/>
<property name="OptionValue"/>
<property name="Caption"/>
<property name="HelpText"/>
</class>
</hibernate-mapping>
Now my problem is when I am trying to enter a new record in table it does not takes the [b]OptionID [/b]as part of insert query and it fails.
Now if i remove the Id property from xml it gives me error because that is a mandotary field.option id is a not null field and it should be unique for each cust id+option type combination.
I got this error [b]ERROR NHibernate.Util.ADOExceptionReporter - LogExceptions:Value cannot be null.
Parameter name: id[/b]
Please help me how to resolve this issue
|