title: I receive exception No Persistence provider for EntityManager in IntelliJ
body: <p>Someone to knows where can be the problem - <a href="https://i.stack.imgur.com/ba4Lf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ba4Lf.png" alt="image"></a></p>
  
  <blockquote>
    <p>Could not find any META-INF/persistence.xml file in the classpath</p>
  </blockquote>
  
  <p>I use IntelliJ and h2 database connection with Hibernate</p>
  
  <p>There are my classes:</p>
  
  <p>persistence:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!--suppress DeprecatedClassUsageInspection --&gt;
  &lt;persistence xmlns="http://java.sun.com/xml/ns/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"&gt;
      &lt;persistence-unit name="StudentPU" transaction-type="RESOURCE_LOCAL"&gt;
          &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
          &lt;class&gt;model.StudentInfo&lt;/class&gt;
          &lt;properties&gt;
              &lt;property name="hibernate.archive.autodetection" value="class" /&gt;
              &lt;property name="hibernate.connection.driver_class" value="org.h2.Driver" /&gt;
              &lt;property name="hibernate.connection.url" value="jdbc:h2:~/JPA_App" /&gt;
              &lt;property name="hibernate.connection.user" value="sa" /&gt;
              &lt;property name="hibernate.connection.password" value="" /&gt;
              &lt;property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" /&gt;
              &lt;property name="hibernate.hbm2ddl.auto" value="update" /&gt;
              &lt;property name="hibernate.show_sql" value="true" /&gt;
              &lt;property name="hibernate.temp.use_jdbc_metadata_defaults"
                        value="false" /&gt;
          &lt;/properties&gt;
  
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>Entity class:</p>
  
  <pre><code>package model;
  
  import javax.persistence.*;
  
  @Entity
  @Table(name = "Student")
  public class StudentInfo {
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private int id;
  
      @Column(name = "name", length = 30, nullable = false)
      private String name;
      @Column(name = "lastname", length = 30, nullable = false)
      private String lastname;
  
      public int getId() {
          return id;
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getLastname() {
          return lastname;
      }
  
      public void setLastname(String lastname) {
          this.lastname = lastname;
      }
  }
  </code></pre>
  
  <p>and Main class</p>
  
  <pre><code>package model;
  
  import javax.persistence.EntityManager;
  import javax.persistence.EntityManagerFactory;
  import javax.persistence.Persistence;
  
  public class AddStudent {
  
      public static void main(String[] args) {
  
          EntityManagerFactory emf = Persistence.createEntityManagerFactory("StudentPU");
          EntityManager em = emf.createEntityManager();
          em.getTransaction().begin();
  
          StudentInfo student = new StudentInfo();
          student.setId(0);
          student.setName("John");
          student.setLastname("Doe");
  
          em.persist(student);
          em.getTransaction().commit();
  
          em.close();
          emf.close();
  
      }
  }
  </code></pre>
  
  <p>In eclipse this simple source works but in IntelliJ I received this exception.
  I would be grateful for any ideas to resolve this error.</p>
  
  <p>Best regards,</p>
  
  <p>D. Balamjiev</p>