一个简单一对一联系 两个类 其中一个用了@OnetoOne 注解
错误提示:
Exception in thread "main" java.lang.NoSuchMethodError: javax.persistence.OneToOne.orphanRemoval()Z
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1560)
at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:762)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:726)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:636)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:359)
at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:838)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:128)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:91)
at text.HibernateORmappingText.TextSchemaExpory(HibernateORmappingText.java:8)
at text.HibernateORmappingText.main(HibernateORmappingText.java:12)
原因hibernate的jar包里面加了那个ejb3的jar包与JPA包冲突 ejb删就OK了
错误提示:
Exception in thread "main" java.lang.NoSuchMethodError: javax.persistence.OneToOne.orphanRemoval()Z
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1560)
at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:762)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:726)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:636)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:359)
at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:838)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:128)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:91)
at text.HibernateORmappingText.TextSchemaExpory(HibernateORmappingText.java:8)
at text.HibernateORmappingText.main(HibernateORmappingText.java:12)
原因hibernate的jar包里面加了那个ejb3的jar包与JPA包冲突 ejb删就OK了
本文介绍了一个使用Hibernate框架时遇到的问题:由于加入了ejb3的jar包导致与JPA包发生冲突,引发异常NoSuchMethodError。文章提供了详细的错误信息及解决方案,即删除冲突的ejb3 jar包即可解决问题。

1161

被折叠的 条评论
为什么被折叠?



