Note that there are some explanatory texts on larger screens.

plurals
  1. PONo Persistence provider for "EntityManager" named "firstOne" Java
    primarykey
    data
    text
    <p>I'm using persistense api to connect to database </p> <p>this is pom.xml dependendcies</p> <pre><code> &lt;groupId&gt;org.hibernate&lt;/groupId&gt; &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt; &lt;version&gt;4.2.8.Final&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;postgresql&lt;/groupId&gt; &lt;artifactId&gt;postgresql&lt;/artifactId&gt; &lt;version&gt;9.1-901.jdbc4&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;javax.persistence&lt;/groupId&gt; &lt;artifactId&gt;persistence-api&lt;/artifactId&gt; &lt;version&gt;1.0.2&lt;/version&gt; </code></pre> <p>persistense.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_1_0.xsd" version="1.0"&gt; &lt;persistence-unit name="firstOne"&gt; &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt; &lt;properties&gt; &lt;property name="hibernate.ejb.cfgfile" value="/META-INF/hibernate.cfg.xml" /&gt; &lt;/properties&gt; &lt;/persistence-unit&gt; &lt;/persistence&gt; </code></pre> <p>hibernate.cfg.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt; &lt;hibernate-configuration&gt; &lt;session-factory&gt; &lt;property name="connection.driver_class"&gt;org.postgresql.Driver&lt;/property&gt; &lt;property name="dialect"&gt;org.hibernate.dialect.PostgreSQLDialect&lt;/property&gt; &lt;property name="hibernate.connection.username"&gt;postgres&lt;/property&gt; &lt;property name="hibernate.connection.password"&gt;tauren993&lt;/property&gt; &lt;property name="hibernate.connection.url"&gt;jdbc:postgresql://localhost:5432/hibernate&lt;/property&gt; &lt;property name="hibernate.hbm2ddl.auto"&gt;create&lt;/property&gt; &lt;property name="hibernate.generate_statistics"&gt;false&lt;/property&gt; &lt;property name="show_sql"&gt;true&lt;/property&gt; &lt;property name="format_sql"&gt;true&lt;/property&gt; &lt;property name="hibernate.cache.use_structured_entries"&gt;false&lt;/property&gt; &lt;property name="hibernate.cache.use_second_level_cache"&gt;false&lt;/property&gt; &lt;mapping class="Employee" /&gt; &lt;/session-factory&gt; &lt;/hibernate-configuration&gt; </code></pre> <p>hibernate.cfg.xml and persistense.xml are stored project/META-INF folder and I'm getting error on</p> <pre><code>EntityManagerFactory emf = Persistence.createEntityManagerFactory("firstOne"); </code></pre> <p>Stack Trace:</p> <pre><code>javax.persistence.PersistenceException: No Persistence provider for EntityManager named firstOne at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) at Main.main(Main.java:14) </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.
 

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