java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode;

前端 未结 1 900
天命终不由人
天命终不由人 2020-12-02 17:06

I am writing example for spring data. This is my spring.xml



        
相关标签:
1条回答
  • 2020-12-02 17:39

    This error occurs because JPA 1 API is brought in, but method getValidationMode exists only since JPA 2.

    Instead of following

    <dependency>
        <groupId>javax.persistence</groupId>
        <artifactId>persistence-api</artifactId>
        <version>1.0.2</version>
    </dependency>
    

    for example one offered by Hibernate can be used:

    <dependency>
      <groupId>org.hibernate.javax.persistence</groupId>
      <artifactId>hibernate-jpa-2.0-api</artifactId>
      <version>1.0.1.Final</version>
    </dependency>
    
    0 讨论(0)
提交回复
热议问题