Hibernate异常:NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/

原创 2015年07月08日 14:23:24

在进行JUnit4测试时,抛异常:

Caused by: java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;

at org.hibernate.cfg.AnnotationBinder.bindManyToOne(AnnotationBinder.java:2881)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1795)
at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:963)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:796)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3788)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3742)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1410)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1844)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1928)
at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:343)
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:431)
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:416)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)

... 53 more


Hibernate异常,之前在另一台电脑上处理过,转移到新电脑就又出现了。

原因是:我用的是Hibernate4.3.5,JavaEE5,hibernate-jpa-2.1-api-1.0.0.Final.jar包与javaee的persistence包冲突了。

解决办法:删掉javaee.jar包中的persistence文件


hibernate--错误:javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey

错误:javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey hibernate4的hibernate-...

struts2中 # % $ (井号,星号,百分号)的区别和用法

源自: http://hi.baidu.com/golotus/blog/item/82e7ded4cf631807a08bb77f.html   struts2 OGNL,...
  • memray
  • memray
  • 2012年12月26日 21:40
  • 1793

javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mem...

java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;

使用hibernate4.3 出现这种问题,通过对比,我发现在model类中如果使用了Table(name="t_user"),就会报这样的错误,但是如果我写成@Entity(name="t_user...

java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index

hibernate 4.3  使用hibernate4.3的时候获取SessionFactory和之前不一样,网上看到一篇(StackOverFlow里面的),可以使用下面的方式: package u...

Caused by: java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index

1、错误描述 WARN:2015-05-01 16:45:37[main] - Exception encountered during context initialization - cancel...

Caused by: java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getValidationMode(

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManage...

Caused by: java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z解决方案

不说别的先贴一段异常信息: Caused by: java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z ...

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

这个异常是在我们配置spring + hibernate annotations的@OneToMany 一对多双向关联后出现的异常。 java.lang.NoSuchMethodError: j...

java.lang.NoSuchMethodError: javax.persistence.PersistenceContext.properties()

java.lang.NoSuchMethodError: javax.persistence.PersistenceContext.properties()[Ljavax/persistence/Pe...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Hibernate异常:NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/
举报原因:
原因补充:

(最多只允许输入30个字)