title: Internal HSQL database complains about privileges
body: <p>I'm setting up a standalone Java service with an in-process, in-memory HSQL database.</p>
  
  <p><strong>Persistence.xml</strong></p>
  
  <pre><code>&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_2_0.xsd"
   version="2.0"&gt;
  
   &lt;persistence-unit name="manager"&gt;
  
   &lt;class&gt;tr.silvercar.data.entities.User&lt;/class&gt;
   &lt;properties&gt;
   &lt;property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" /&gt;
   &lt;property name="javax.persistence.jdbc.user" value="sa" /&gt;
   &lt;property name="javax.persistence.jdbc.password" value="" /&gt;
   &lt;property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:mem:testdb" /&gt;
  
   &lt;property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" /&gt;
   &lt;property name="hibernate.max_fetch_depth" value="3" /&gt;
  
   &lt;!-- cache configuration --&gt;
  &lt;!-- 
   &lt;property name="hibernate.ejb.classcache.org.hibernate.ejb.test.Item"
    value="read-write" /&gt;
   &lt;property
    name="hibernate.ejb.collectioncache.org.hibernate.ejb.test.Item.distributors"
    value="read-write, RegionName" /&gt;
   --&gt;
   &lt;/properties&gt;
  
   &lt;/persistence-unit&gt;
  
  &lt;/persistence&gt;
  </code></pre>
  
  <p><strong>Code</strong></p>
  
  <pre><code>  emf = Persistence.createEntityManagerFactory("manager");
  
    User newUser = new User();
    newUser.setName("Testgebruiker");
    newUser.setCredits(100);
  
    System.out.println("Inserting user");
    EntityManager em = emf.createEntityManager();
    em.persist(newUser);
    em.close();
  
    System.out.println("Getting user");
    em = emf.createEntityManager();
    User u = (User) em.createQuery("SELECT u FROM User u").getSingleResult();
    em.close();
    System.out.println(u);
  </code></pre>
  
  <p>It would seem to me that since the database is in memory, and Hibernate should generate tables, that I don't need to do anything else. However, upon calling <code>getSingleResult</code> I get the exception:</p>
  
  <pre><code>org.hsqldb.HsqlException: user lacks privilege or object not found: USER
  </code></pre>