title: Error: Deprecated PersistenceProvider, use HibernatePersistenceProvider instead of HibernatePersistence
body: <p>I think this is a very common problem for all beginners like me. But I could not find a solution. Yet.</p>
  
  <p>File persistence.xml is in src/META-INF/persistence.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&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="jobs"&gt;
  
      &lt;!-- provedor/implementacao do JPA --&gt;
      &lt;provider&gt;org.hibernate.ejb.HibernatePersistenceProvider&lt;/provider&gt;
  
      &lt;!-- entidade mapeada --&gt;
      &lt;class&gt;
          br.com.caelum.tarefas.modelo.Job
      &lt;/class&gt;
  
      &lt;properties&gt;
          &lt;!-- dados da conexao --&gt;
          &lt;property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" /&gt;
          &lt;property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost/fj21" /&gt;
          &lt;property name="javax.persistence.jdbc.user" value="root" /&gt;
          &lt;property name="javax.persistence.jdbc.password" value="root" /&gt;
  
          &lt;!-- propriedades do hibernate --&gt;
          &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" /&gt;
          &lt;property name="hibernate.show_sql" value="true" /&gt;
          &lt;property name="hibernate.format_sql" value="true" /&gt;
  
          &lt;!-- atualiza o banco, gera as tabelas se for preciso --&gt;
          &lt;property name="hibernate.hbm2ddl.auto" value="update" /&gt;
  
      &lt;/properties&gt;
  &lt;/persistence-unit&gt;
  </code></pre>
  
  <p></p>
  
  <p>When I run the code</p>
  
  <pre><code>try
  {
      EntityManagerFactory factory = Persistence.createEntityManagerFactory("tarefas");
      EntityManager manager = factory.createEntityManager();
  
      manager.close();
      factory.close();
      System.out.println("Execução com sucesso!");
  }catch(Exception _Ex)
  {
      System.out.println("Erro: " + _Ex.getMessage());
  }
  </code></pre>
  
  <p>I get the message </p>
  
  <pre><code>27/03/2014 11:35:18 org.hibernate.ejb.HibernatePersistence logDeprecation WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
  27/03/2014 11:35:18 org.hibernate.ejb.HibernatePersistence logDeprecation WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
  27/03/2014 11:35:18 org.hibernate.ejb.HibernatePersistence logDeprecation WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
  Erro: No Persistence provider for EntityManager named jobs
  </code></pre>
  
  <p>What I'm doing wrong?</p>