`
frinder
  • 浏览: 36492 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

hibernate 3.5 一对多单项关联(OneToMany)

 
阅读更多
Exception in thread "main" java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1912)
at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:796)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:707)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:4035)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3989)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1398)
at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:1002)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:130)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:92)
at com.soft.ProvinceTest.createSchema(ProvinceTest.java:21)

at com.soft.ProvinceTest.main(ProvinceTest.java:26)

解决办法:

使用MyEclipse8.5,MyEclipse8.6创建JavaEE5.0的Web项目,在使用Hibernate3.5.1的注解功能时出现错误:

java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z 。

解决办法:删除对Java EE 5 Libraries的使用。

问题原因:javaee.jar中的部分类与hibernate-jpa-2.0-api-1.0.0.Final.jar存在版本冲突。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics