Note that there are some explanatory texts on larger screens.

plurals
  1. PONo Persistence provider for EntityManager Hibernate
    primarykey
    data
    text
    <p>I am having a <code>No Persistence provider for EntityManager</code> exception, and can't figure out what is causing it. Here is my configuration file:</p> <p><strong>Persistence.xml</strong> (stored in <code>src/META-INF</code>)</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;persistence version="2.0" 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"&gt; &lt;persistence-unit name="HatifimJPA" transaction-type="RESOURCE_LOCAL"&gt; &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt; &lt;class&gt;entities.HatUser&lt;/class&gt; &lt;properties&gt; &lt;property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver" /&gt; &lt;property name="hibernate.connection.username" value="Benny" /&gt; &lt;property name="hibernate.connection.password" value="oracle" /&gt; &lt;property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:xe" /&gt; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" /&gt; &lt;/properties&gt; &lt;/persistence-unit&gt; &lt;/persistence&gt; </code></pre> <p>Exception:</p> <blockquote> <p>Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named HatifimJPA at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) at testing.TestClass.main(TestClass.java:16)</p> </blockquote> <p>The only difference is that I am trying to get the <code>EntityManager</code> into a <code>public void main(...) { ... }</code> block, however, I don't recall having a problem doing that in the past.</p> <p>Can anyone help to point out where my problem might reside?</p>
    singulars
    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