title: Make HSQL database persistent in LightAdmin (Spring/JPA/Hibernate)
body: <p>I am trying to change the default <a href="https://github.com/la-team/light-admin" rel="nofollow">LightAdmin</a> setup that uses an in-memory HSQL database to use a file HSQL database. </p>
  
  <p>persistence.xml:</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="DEMO" transaction-type="RESOURCE_LOCAL"&gt;
          &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
          &lt;class&gt;org.lightadmin.demo.model.Address&lt;/class&gt;
          &lt;class&gt;org.lightadmin.demo.model.Customer&lt;/class&gt;
          &lt;class&gt;org.lightadmin.demo.model.EmailAddress&lt;/class&gt;
          &lt;class&gt;org.lightadmin.demo.model.Product&lt;/class&gt;
          &lt;class&gt;org.lightadmin.demo.model.Order&lt;/class&gt;
          &lt;class&gt;org.lightadmin.demo.model.LineItem&lt;/class&gt;
          &lt;class&gt;org.lightadmin.demo.model.DiscountProgram&lt;/class&gt;
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>spring-context.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:jdbc="http://www.springframework.org/schema/jdbc"
         xmlns:context="http://www.springframework.org/schema/context"
         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
            http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"&gt;
  
      &lt;context:component-scan base-package="org.lightadmin.demo.service"/&gt;
  
      &lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
            p:persistenceUnitName="DEMO" p:dataSource-ref="dataSource"&gt;
          &lt;property name="jpaVendorAdapter"&gt;
              &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"&gt;
                  &lt;property name="generateDdl" value="true"/&gt;
                  &lt;property name="database" value="HSQL"/&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;jdbc:embedded-database id="dataSource" type="HSQL"&gt;
          &lt;jdbc:script location="classpath:db/schema.sql" encoding="UTF-8"/&gt;
          &lt;jdbc:script location="classpath:db/data.sql" encoding="UTF-8"/&gt;
      &lt;/jdbc:embedded-database&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>What I have tried: in persistence.xml provided the following properties:</p>
  
  <pre><code>&lt;property name="hibernate.connection.url" value="jdbc:hsqldb:file:database"/&gt;
  &lt;property name="hibernate.hbm2ddl.auto" value="update" /&gt;
  </code></pre>
  
  <p>But it did not do its job.</p>