Hibernate 5.2.2: No Persistence provider for EntityManager
<p>What has changed between Hibernate 5.1.1 and 5.2.2? If I use 5.2.2 I'll get an error message "No Persistence provider for EntityManager named pu". Exactly the same configuration works with 5.1.1. How should I change my code to get 5.2.2 to work?</p>

<p>pom.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;jpatest&lt;/groupId&gt;
    &lt;artifactId&gt;jpatest&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;

    &lt;properties&gt;
        &lt;hibernate.version&gt;5.2.2.Final&lt;/hibernate.version&gt;
    &lt;/properties&gt;
    &lt;dependencies&gt;
        &lt;!-- https://mvnrepository.com/artifact/junit/junit --&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;junit&lt;/groupId&gt;
            &lt;artifactId&gt;junit&lt;/artifactId&gt;
            &lt;version&gt;4.12&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;!-- https://mvnrepository.com/artifact/org.postgresql/postgresql --&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
            &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
            &lt;version&gt;9.4.1209.jre7&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core --&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
            &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
            &lt;version&gt;${hibernate.version}&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
            &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
            &lt;version&gt;${hibernate.version}&lt;/version&gt;
        &lt;/dependency&gt;
    &lt;/dependencies&gt;
&lt;/project&gt;
</code></pre>

<p>persistence.xml in src/main/resources/META-INF</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
&lt;persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
    version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"&gt;
    &lt;persistence-unit name="pu" &gt;
        &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
        &lt;properties&gt;
            &lt;property name="hibernate.archive.autodetection" value="class" /&gt;
            &lt;property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" /&gt;
            &lt;property name="hibernate.connection.driver_class" value="org.postgresql.Driver" /&gt;
            &lt;property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/mydb" /&gt;
            &lt;property name="hibernate.default_schema" value="myschema" /&gt;
            &lt;property name="hibernate.connection.username" value="xxx" /&gt;
            &lt;property name="hibernate.connection.password" value="zzz" /&gt;
            &lt;!-- &lt;property name="hibernate.show_sql" value="true"/&gt; --&gt;
            &lt;property name="hibernate.flushMode" value="FLUSH_AUTO" /&gt;
            &lt;property name="hibernate.hbm2ddl.auto" value="validate" /&gt;
        &lt;/properties&gt;
    &lt;/persistence-unit&gt;
&lt;/persistence&gt;
</code></pre>

<p>creating EntityManager       </p>

<pre><code>factory = Persistence.createEntityManagerFactory("pu");
em = factory.createEntityManager();
tx = em.getTransaction();
</code></pre>