NHibernet insert query fails

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mzmishra
    Recognized Expert Contributor
    • Aug 2007
    • 390

    NHibernet insert query fails

    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:nhib ernate-mapping-2.2" default-lazy="false">

    <class name="myVRM.Dat aLayer.vrmCusto mAttributes, vrmDataLayer" table="Dept_Cus tomAttr_Option_ D">

    <id name="OptionID" column="OptionI D" 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="CustomAtt ributeID"/>
    <property name="DeptID"/>
    <property name="OptionTyp e"/>
    <property name="OptionID"/>
    <property name="OptionVal ue"/>
    <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 optionid 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.

    Please help me how to resolve this issue
  • mzmishra
    Recognized Expert Contributor
    • Aug 2007
    • 390

    #2
    Forgot to add option id is a not null field and it should be unique for each cust id+option type cobination.

    how can i modify the xml to make the insert successful

    Comment

    • mzmishra
      Recognized Expert Contributor
      • Aug 2007
      • 390

      #3
      any idea how to do this.any one Nhibernet expert.please advice

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Try them? Nhibernet experts

        Comment

        Working...