首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

异常org.hibernate.AnnotationException: No identifier specified for entity

2012-09-21 
错误org.hibernate.AnnotationException: No identifier specified for entityAnnotationExceptionNo iden

错误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") })    

1 楼 hane00 2012-06-01   top !

热点排行