[英]JPA GenerationType.IDENTITY not considering column with auto increment in MS SQL
[英]Hibernate 1.0 + JPA + Netbeans 7.01 + Sql server 2005 = Problems to insert into table with GenerationType.IDENTITY
我的环境:
Hibernate 1.0 JPA Netbeans 7.01 SQL Server 2005
部分代码:
public class EdiAgendamentoCliente implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue (strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id_edi", unique = true, nullable = true)
private Integer idEdi;
错误:
“ java.lang.IllegalArgumentException:要加载的ID需要加载”
我试图用自动增量将值插入到表中,但是它不起作用,你们能给我一些指导吗?
将其更改为可为空的false,并检查数据库中的列名称是否与name属性匹配
@Column(name = "id_edi", unique = true, nullable = false)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.