Hibernate: insert into TMe_MerchandiseCInfo (ID, MerchandiseCName, SortID, State, MerchandiseCID) values (?, ?, ?, ?, ?)
[11-11 10:53:41] [http-bio-8080-exec-1] [ERROR][org.hibernate.engine.jdbc.spi.SqlExceptionHelper-146]-当 IDENTITY_INSERT 设置为 OFF 时,不能为表 ‘TMe_MerchandiseCInfo‘ 中的标识列插入显式值。
[11-11 10:53:41] [http-bio-8080-exec-1] [ERROR][org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl-175]-HHH000352: Unable to release batch statement...
[11-11 10:53:41] [http-bio-8080-exec-1] [ERROR][org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl-176]-HHH000246: SQLException escaped proxy
java.sql.SQLException: org.apache.commons.dbcp.DelegatingPreparedStatement with address: "SQLServerPreparedStatement:32" is closed.
hibernate框架默认给数据库中的所有字段插值,包括自增长,所以会报上面的错误,如果不想让hibernate给你的某个字段插值在加上这句(@Column(name = "字段名"insertable = false,updatable = false,deletetable=false))三个的意思是,插入(更新)(删除)数据时不给某字段赋值
@Column(name = "ID")