should be mapped with insert="false" update="false"
我 找了好久原来是个低级错误,在copy的时候不小心的缘故
<hibernate-mapping package="com.strive.entity">
<class name="Dept" table="Dept"><id name="deptno" column="deptno" type="integer">
<generator class="assigned"></generator>
</id>
<property name="dname" column="deptno" type="string"></property>
<property name="loc" column="loc" type="string"></property>
</class>
</hibernate-mapping>