0 Replies Latest reply on Jun 20, 2006 8:40 AM by Martin Ganserer

    HSQL-DB problem

    Martin Ganserer Novice

      Hello,

      I created a small test project with an embedded HSQLDB.

      Everything works fine, but I can not persist data. I don't get an exception but after making a commit no data is present in my table.

      Here are some fragments of my source code:

      ?xml version="1.0" encoding="UTF-8"?>
      <persistence xmlns="http://java.sun.com/xml/ns/persistence">
       <persistence-unit name="cust" transaction-type="RESOURCE_LOCAL">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <class>com.kontron.entity.Customer</class>
       <class>com.kontron.entity.Country</class>
       <properties>
       <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
       <property name="hibernate.connection.url" value="jdbc:hsqldb:data/localDB"/>
       <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
       <property name="hibernate.connection.username" value="sa"/>
       <property name="hibernate.connection.password" value=""/>
       <property name="hibernate.max_fetch_depth" value="3"/>
       <property name="hibernate.show_sql" value="true"/>
       <property name="hibernate.hbm2ddl.auto" value="none" />
       </properties>
       </persistence-unit>
      </persistence>
      


      Here is my java code:

      EntityManagerFactory emf = Persistence.createEntityManagerFactory("cust");
       EntityManager em = emf.createEntityManager();
      
      
       CustomerService src = new CustomerService();
       src.setEntityManager(em);
      
       em.getTransaction().begin();
      
      
       Customer cust = new Customer();
       cust.setId(2);
       cust.setName("Hallo AG");
       src.persistCustomer(cust);
      
       em.getTransaction().commit();
      
       em.close();
       emf.close();


      What am I doing wrong?