0

I am getting this error:

Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named tarefas at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:61)

My jars is okay, as you seem in the pom.xml

My main class:

import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class GeraTabelas {

    public static void main(String[] args) 
    {   
        EntityManagerFactory factory = Persistence.createEntityManagerFactory("tarefas");
        factory.close();

    }
}

pom.xml

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
<version>5.2.2.Final</version>
</dependency>

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
  <version>4.3.9.Final</version>
</dependency>

persistence.xml

<persistence-unit name="tarefas">

   <!-- provedor/implementacao do JPA -->
   <provider>org.hibernate.ejb.HibernatePersistence</provider>

   <!-- entidade mapeada -->
   <class>br.com.abc.models.Usuario</class>

     <properties>

  <property name="hibernate.connection.url" value= .... //The rest of properties...

</properties>
</persistence-unit>

It may be the position of the pom.xml file in the wrong location? I did this way because of others posts that said it was this way but this interrogation point appears in the folders and I am beginner in Maven to know what it is.

Maven and persistence

Thanks.

JamesB
  • 569
  • 1
  • 9
  • 31
  • the question mark means that that file is not added yet to repository which you are using – Khalil M Aug 26 '16 at 16:14
  • it has nothing to do with your issue, you're propably using some SVN, and as you didn't commit your changes into the repository more info [here](http://stackoverflow.com/questions/4307086/why-does-eclipse-java-package-explorer-show-question-mark-on-some-classes) – Khalil M Aug 26 '16 at 16:26

0 Answers0