title: How to configure JPA + HIBERNATE using Spring Boot
body: <p>I want to work with my database using entiies and jpa.</p>
  
  <p>When i am just trying to create bean in <strong><em>SpringConfig.java</em></strong>:  </p>
  
  <pre><code>    @Bean
      @Singleton
      public EntityManager getEntityManager(){
          return Persistence.createEntityManagerFactory("collection").createEntityManager();
      }
  </code></pre>
  
  <p>I have:  </p>
  
  <pre><code>Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named collection:  No META-INF/persistence.xml was found in classpath.
  </code></pre>
  
  <p>But name "<strong><em>collection</em></strong>" is the same as in <strong><em>persistence-unit</em></strong> name   </p>
  
  <p>my <strong>persistence.xml</strong> is in <em>resources</em> (<strong><em>src/main/resources</em></strong>) and configured as jpa in spring boot</p>
  
  <p><strong><em>UPDATE</em></strong>:</p>
  
  <p>When i am trying to put persistence.xml in resources/META-INF/ I have another exception:  </p>
  
  <pre><code>Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named collection: Provider named org.hibernate.jpa.HibernatePersistenceProvider threw unexpected exception at create EntityManagerFactory: 
  java.lang.NoSuchMethodError
  </code></pre>