Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Gaston, I have some suggestions/questions for you:</p> <p><strong>1 - Is this the code you're trying to execute?</strong></p> <pre><code>package entity; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.junit.After; import org.junit.Before; import org.junit.Test; public class PersonTest { private EntityManagerFactory emf; private EntityManager em; @Before public void initEmfAndEm() { BasicConfigurator.configure(); Logger.getLogger("org").setLevel(Level.ERROR); emf = Persistence.createEntityManagerFactory("examplePersistenceUnit"); em = emf.createEntityManager(); } @After public void cleanup() { em.close(); } @Test public void emptyTest() { } } </code></pre> <p>If it is, try to comment this line: "Logger.getLogger("org").setLevel(Level.ERROR);". Or change it to "Logger.getLogger("org").setLevel(Level.ALL);". Then you should see the errors on the output console.</p> <p><strong>2 - In your persistence.xml I see you're using hsqldb database. Did you installed/configured it properly?</strong></p> <p>If you dont't know this database, I suggest you use MySQL, PostgreSQL, or some database you are familiar with.</p> <p><strong>3 - Check you persistence.xml. Mine is a little bite different:</strong></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="App1PU" transaction-type="RESOURCE_LOCAL"&gt; &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt; &lt;class&gt;com.entities.User&lt;/class&gt; &lt;class&gt;com.entities.Group&lt;/class&gt; &lt;properties&gt; &lt;property name="javax.persistence.jdbc.url" value="jdbc:mysql://myIP:3306/mydatabase"/&gt; &lt;property name="javax.persistence.jdbc.password" value="secret"/&gt; &lt;property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/&gt; &lt;property name="javax.persistence.jdbc.user" value="myUser"/&gt; &lt;/properties&gt; &lt;/persistence-unit&gt; &lt;/persistence&gt; </code></pre> <p>Notice the header has some XML declarations that might be important, since Hibernate is telling you that your file is incorrect.</p>
 

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