我正在使用Microsoft SQL Server數據庫。
在我的Hibernate映射文件,我已經聲明爲無法在休眠表中插入記錄
<id name="item_Group_Sid" type="int" column="ITEM_GROUP_SID" >
<generator class="native"/>
</id>.
我試圖插入表中的一條記錄的主鍵。 但我得到錯誤,如
不允許DEFAULT或NULL作爲顯式標識值。
我的hibernate.cfg.xml是
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="hibernate.connection.url">**</property>
<property name="hibernate.connection.username">**</property>
<property name="hibernate.connection.password">**</property>
<property name="hibernate.dialect">org.hibernate.dialect.DB2Dialect</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>
<mapping resource="ItemGroup.hbm.xml"/>
</session-factory>
</hibernate-configuration>
分享您hibernate.cfg.xml文件在這裏 –
嗨Ransher辛格,感謝您的答覆。 我已經用hibernate.cfg.xml更新了這個問題。 請告訴我 – KKR