我用的是Hibernate3, 数据库 SQL Server 2005

在向数据库插入记录时,出现ConstraintViolationException:could not insert异常,但我检查了,要插入的数据满足所有的约束条件,而且向其他表插入记录都没有问题,就只这一个表有问题。

在hbm.xml中ID的配置如下:
程序代码:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
   
<hibernate-mapping package="pbc.bz.intendance.model">
   <class name="Intendance" table="t_intendance" >
      <!-- 映射标识属性 -->
      <id name="intendId" column="intend_id" type="java.lang.Integer">
         <generator class="identity" />
      </id>
     
      <!-- 下面映射其他普通属性 -->
      <property name="projectName" column="project_name" type="string" not-null="true" lazy="false" />
      <property name="checkDate"   column="check_date"   type="date"   not-null="true" lazy="false" />
      <property name="transactor"  column="transactor"   type="string" not-null="true" lazy="false" />
      <property name="beChecked"   column="be_checked"   type="string" not-null="true" lazy="false" />
      <property name="problemKind" column="problem_kind"  type="string" not-null="true" lazy="false" />
      <property name="problemDesc" column="problem_desc"  type="text"  not-null="true" lazy="false" />
      <property name="riskKind"    column="risk_kind"    type="string" not-null="true" lazy="false" />
      <property name="controllable" column="controllable"  type="text" not-null="true" lazy="false" />
      <property name="reason"      column="reason"       type="string" not-null="true" lazy="false" />
      <property name="behindDuty"  column="behind_duty"  type="string" not-null="true" lazy="false" />
     
      <!-- 映射该Intendance所关联的User: recorder/rechecker/assessor -->
      <many-to-one name="recorder" column="recorder" class="User" not-null="true" lazy="false" />
      <many-to-one name="rechecker" column="rechecker" class="User" lazy="false" />
      <many-to-one name="assessor" column="assessor" class="User" lazy="false" />
     
      <!-- 映射该Intendance关联的反馈信息Feedback -->
      <many-to-one name="back" column="back_id" class="Feedback" lazy="false" />
      <!-- 映射该Intendance所处的状态State -->
      <many-to-one name="stat" column="state_id" class="State" lazy="false"/>
     
     
      <!-- 配置监督信息Intendance与用户User的映射关系(修改关系--多对多) -->
      <set name="modifier" table="t_modification_of_intend" lazy="false" inverse="true">
         <key column="intend_id" />
         <one-to-many class="ModificationOfIntendance" />
      </set>
     
      <property name="submitDate" column="submit_date" type="timestamp" not-null="true" lazy="false" />

   </class>
</hibernate-mapping>
其中,rechecker, assessor, back三个属性可以为空,在插入之前,我将其设置为null.


在网上找的情况都与我这里不一样,
有人说把<generator class="identity"/> 改为 <generator class="assigned"/>
我试了,还是不行。

请问有什么解决方法?