Note that there are some explanatory texts on larger screens.

plurals
  1. PONo Persistence provider for EntityManager named... error
    primarykey
    data
    text
    <p>My persistence xml file is like that </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_1_0.xsd" version="1.0"&gt; &lt;persistence-unit name="hibernateEbru"&gt; &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt; &lt;class&gt;com.hibernate.business_card&lt;/class&gt; &lt;properties&gt; &lt;property name="hibernate.hbm2ddl.auto" value="create" /&gt; &lt;property name="hibernate.show_sql" value="true" /&gt; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" /&gt; &lt;property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" /&gt; &lt;property name="hibernate.connection.username" value="root" /&gt; &lt;property name="hibernate.connection.password" value="2643" /&gt; &lt;property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/BusinessDb" /&gt; &lt;/properties&gt; &lt;/persistence-unit&gt; &lt;/persistence&gt; </code></pre> <p>Then I have my code calling it with this:</p> <pre><code>public class test { public static void main(String[] args) { EntityManagerFactory emf = Persistence.createEntityManagerFactory("hibernateEbru"); EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); business_card bc = new business_card(); bc.setName("Ebru"); em.persist(bc); em.getTransaction().commit(); em.close(); emf.close(); } } </code></pre> <p>I got the following error message:</p> <pre><code>Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named hibernateEbru at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:56) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34) at com.hibernate.test.main(test.java:8) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload