Note that there are some explanatory texts on larger screens.

plurals
  1. POError using Hibernate with H2 in memory database
    text
    copied!<p>I'm working with Hibernate. How can I configure my persistence.xml to have an H2 in-memory database?</p> <p>My <strong>persistence.xml</strong> is:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;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" version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"&gt; &lt;persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL"&gt; &lt;class&gt;com.mastertheboss.domain.Employee&lt;/class&gt; &lt;class&gt;com.mastertheboss.domain.Department&lt;/class&gt; &lt;properties&gt; &lt;property name="javax.persistence.jdbc.driver" value="org.h2.Driver" /&gt; &lt;property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:test;DB_CLOSE_DELAY=-1" /&gt; &lt;property name="javax.persistence.jdbc.user" value="sa" /&gt; &lt;property name="javax.persistence.jdbc.password" value="" /&gt; &lt;property name="hbm2ddl.auto" value="update" /&gt; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" /&gt; &lt;/properties&gt; &lt;/persistence-unit&gt; &lt;/persistence&gt; </code></pre> <p>But when I run my app I get the following <strong>error</strong>:</p> <p><code>Internal Exception: org.h2.jdbc.JdbcSQLException: Table "EMPLOYEE" not found; SQL statement: SELECT ID, NAME, DEPARTMENT_ID FROM EMPLOYEE [42102-171] Error Code: 42102 Call: SELECT ID, NAME, DEPARTMENT_ID FROM EMPLOYEE Query: ReadAllQuery(referenceClass=Employee sql="SELECT ID, NAME, DEPARTMENT_ID FROM EMPLOYEE")</code></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