当我尝试通过hibernate提交到sql Server时,我收到JDBC错误
Cannot insert explicit value for identity column in table ‘Report’ when IDENTITY_INSERT is set to OFF
我使用的netbeans生成的映射包含,
<class name="orm.generated.Report" table="Report" schema="dbo" catalog="DatabaseName"> <id name="id" type="int"> <column name="ID" /> <generator class="assigned" /> </id>
在我看来它应该正确地进行身份插入.
有关如何解决此问题的任何想法?
编辑:
一些链接到文档,为后代,
http://www.hibernate.org/hib_docs/v3/reference/en-US/html/mapping.html#mapping-declaration-id-generator
http://www.roseindia.net/hibernate/hibernateidgeneratorelement.shtml