I have some troubles getting hibernate 3.5 working properly with HSQLDB (in process mode), I got same issues with SQLite [1] but everything works as excepted with mysql.
I'm new to hibernate and all this java art so forgive me if I make big errors.

The problem is each time I start my app which creates and populates serveral table, the next run the db seems empty, and I have to fill it again.

I've setup a project using the 3.5 version of hibernate using JPA/EJB. I've setup a persistence unit (thanks to netbeans) automatically generating the presistence.xml needed for the emf setup



<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.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_1_0.xsd">
  <persistence-unit name="PMMPU2" transaction-type="RESOURCE_LOCAL">
      <property name="hibernate.connection.username" value="SA"/>
      <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
      <property name="hibernate.connection.password" value=""/>
      <property name="hibernate.connection.url" value="jdbc:hsqldb:file:db/base;shutdown=true"/>
      <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
      <property name="hibernate.hbm2ddl.auto" value="update"/>

</code> http://java.pastebin.com/LFfB0gSt

I have also a HibernateUtil which helps me with emf & em:


public class HibernateUtil {

    private static EntityManagerFactory emf = null;
    private static EntityManager em = null;

    public static EntityManagerFactory getEmf()
        if(emf == null)
                        Map<String, Object> configOverrides = new HashMap<String, Object>();
          //  configOverrides.put("hibernate.hbm2ddl.auto", "update");
            configOverrides.put("hibernate.show_sql", "true");
            emf = Persistence.createEntityManagerFactory("PMMPU2", configOverrides);

            return emf;

    public static EntityManager getEm()
        if(em == null)
            em = getEmf().createEntityManager();
        return em;

</code> http://java.pastebin.com/kvyxruH0

1) As you can see I overdrive some settings getEMF.
2) How should a use EM instances; one for all the app, is that different on desktop & web ?
3) How could I change HSQLDB options with hibernate to use CACHED tables by default ?

[1] sqliteJDBC http://www.zentus.com/sqlitejdbc/ + hibernate-sqlite http://code.google.com/p/hibernate-sqlite/