hibernate 自动编号的问题

我在数据库中设置了
id int identity(1,1) not null primary key,
建好数据库
通过操作Hibernate的发生这样的错误:
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]当 IDENTITY_INSERT 设置为 OFF 时,不能向表 'person' 中的标识列插入显式值。
不修改数据库的情况下怎么才能避免此类错误.


 

 /*最佳答案*/

*.hbm.xml当中没有设置自动增长吧!要不就是设置错误!

<id name="id" type="integer">
<column name="id" />
<generator class="native" />
</id>
native为自动增长!

你可能感兴趣的:(Hibernate)