title: How to get automatic table creation working in spring / hibernate / jpa?
body: <p>I can't get automatic table creation working in spring when using hibernate / jpa.</p>
  
  <p>Here are my config files:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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_1_0.xsd"
     version="1.0"&gt;
  
      &lt;persistence-unit name="naveroTest"&gt;
       &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
       &lt;class&gt;xxx&lt;/class&gt;
          ...
  
  
          &lt;properties&gt;
              &lt;property name="hibernate.archive.autodetection" value="class, hbm"/&gt;
              &lt;property name="hibernate.show_sql" value="true"/&gt;
              &lt;property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/&gt;
     &lt;property name="hibernate.connection.url" value="jdbc:hsqldb:file:/tmp/naveroTestDB"/&gt;
              &lt;property name="hibernate.connection.username" value="sa"/&gt;
              &lt;property name="hibernate.connection.password" value=""/&gt; 
              &lt;property name="hibernate.hbm2ddl.auto" value="create"/&gt;
              &lt;property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/&gt;
          &lt;/properties&gt;
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>context.xml</p>
  
  <pre><code>   &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;beans xmlns:tx="http://www.springframework.org/schema/tx"
          xmlns="http://www.springframework.org/schema/beans" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                              http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
                             http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd"&gt;
  
       &lt;!-- For auto creation of tables --&gt;
       &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
        &lt;property name="driverClassName" value="org.hsqldb.jdbcDriver" /&gt;
        &lt;property name="url" value="jdbc:hsqldb:file:/tmp/naveroTestDB" /&gt;
        &lt;property name="username" value="sa" /&gt;
        &lt;property name="password" value="" /&gt;
       &lt;/bean&gt;
  
       &lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
        &lt;property name="dataSource" ref="dataSource" /&gt;
        &lt;property name="loadTimeWeaver"&gt;
         &lt;bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" /&gt;
        &lt;/property&gt;
        &lt;property name="jpaVendorAdapter"&gt;
         &lt;bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"&gt;
          &lt;property name="generateDdl" value="true" /&gt;
          &lt;property name="databasePlatform" value="org.hibernate.dialect.HSQLDialect" /&gt;
          &lt;property name="showSql" value="true" /&gt;
         &lt;/bean&gt;
        &lt;/property&gt;
       &lt;/bean&gt;
  
       &lt;bean id="PictureBean" class="de.navero.server.bl.PictureBean"&gt;
        &lt;property name="entityManagerFactory"&gt;&lt;ref local="entityManagerFactory" /&gt;&lt;/property&gt;
       &lt;/bean&gt;
  
      &lt;/beans&gt;
  </code></pre>
  
  <p>Any ideas what may be wrong?
  Thanks for any help :).</p>