您的位置:首页 > 其它

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

2011-12-17 13:28 381 查看
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存在版本冲突。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: