Hibernate 3.5.x: NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval

前端 未结 6 1088
面向向阳花
面向向阳花 2020-12-01 14:47

I\'m trying to upgrade to Hibernate 3.5.3-FINAL.

When running my unit tests, I now receive the following exception:

java.lang.NoSuchMethodError: java         


        
6条回答
  •  没有蜡笔的小新
    2020-12-01 15:32

    As pointed out by Timo, remove persistence-api-1.0.jar.

    Just in case, here are the dependencies I'm using:

    org.hibernate:hibernate-entitymanager:jar:3.5.3-Final:compile
    +- org.hibernate:hibernate-core:jar:3.5.3-Final:compile
    |  +- antlr:antlr:jar:2.7.6:compile
    |  +- commons-collections:commons-collections:jar:3.2:compile
    |  +- dom4j:dom4j:jar:1.6.1:compile
    |  |  \- xml-apis:xml-apis:jar:1.0.b2:compile
    |  \- javax.transaction:jta:jar:1.1:compile
    +- org.hibernate:hibernate-annotations:jar:3.5.3-Final:compile
    |  \- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
    +- cglib:cglib:jar:2.2:compile
    |  \- asm:asm:jar:3.1:compile
    +- javassist:javassist:jar:3.9.0.GA:compile
    \- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:compile
    

    I'm getting them from this single declaration in my pom.xml:

    
      org.hibernate
      hibernate-entitymanager
      3.5.3-Final
    
    

    This should somehow answer your indulgent rant (if I rephrase: use Maven - or know what you're doing).

提交回复
热议问题