HibernatePersistenceProvider threw unexpected exception at create EntityManagerFactory with java.lang.NoSuchMethodError

The biggest challenge I had with getting Hibernate JPA working was to figure out the required dependencies. It seems there is not a single documentation in hibernate site on step by step how to configure a JPA with Hibernate. Thus, it was process that reading a lot of documentation online, making assumptions on required dependencies, and working through errors by trial and error method.

Following error is the one of the most strange one. The error has no indication on what is wrong. Apparently, hibernate has


Provider named org.hibernate.jpa.HibernatePersistenceProvider threw unexpected exception at create EntityManagerFactory:
java.lang.NoSuchMethodError

the JPA dependency wrapped. Therefore, having following dependency in your pom is going to give you above pain. Once removed from your pom, the Hibernate JPA was properly initialized and entity manager was properly created.


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