异常org.hibernate.AnnotationException: No identifier specified for entity
错误org.hibernate.AnnotationException: No identifier specified for entity
AnnotationExceptionNo identifier specified for entity错误org.hibernate.AnnotationException: No identifier specified for entityorg.hibernate.AnnotationException: No identifier specified for entity.
报这个异常的原因是因为JavaBeam的主键没有注解映射关系
解决方案如下:
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="ID", unique=true, nullable=false, insertable=true, updatable=false, precision=20, scale=0)
或者
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "sequence",
parameters = { @Parameter(name = "sequence", value = "TEST_SEQ") })
AnnotationExceptionNo identifier specified for entity错误org.hibernate.AnnotationException: No identifier specified for entityorg.hibernate.AnnotationException: No identifier specified for entity.
报这个异常的原因是因为JavaBeam的主键没有注解映射关系
解决方案如下:
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="ID", unique=true, nullable=false, insertable=true, updatable=false, precision=20, scale=0)
或者
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "sequence",
parameters = { @Parameter(name = "sequence", value = "TEST_SEQ") })
1 楼
hane00
2012-06-01
top !