title: How to set some Hibernate properties in Spring JPA Web Application?
body: <p>I am trying to get rid of the typical <code>persistence.xml</code> file in Spring JPA web application. So far, I have managed to inject the <code>EntityManager</code> successfully with the following:</p>
  
  <pre><code>@Configuration
  @EnableTransactionManagement
  public class JpaConfig {
  
      @Bean
      public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean(){
  
          LocalContainerEntityManagerFactoryBean factoryBean
              = new LocalContainerEntityManagerFactoryBean();
  
          factoryBean.setDataSource( this.restDataSource() );
          factoryBean.setPackagesToScan( new String[ ] { "com.jverstry" } );
          factoryBean.setPersistenceUnitName("MyMy");
  
          JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(){
           {
              // JPA properties ...
           }
          };
  
          factoryBean.setJpaVendorAdapter( vendorAdapter );
  
          return factoryBean;
  
      }
  
      @Bean
      public DataSource restDataSource(){
  
          DriverManagerDataSource dataSource = new DriverManagerDataSource();
  
          dataSource.setDriverClassName("org.hsqldb.jdbcDriver");
          dataSource.setUrl("jdbc:hsqldb:mem:testdb");
          dataSource.setUsername("sa");
          dataSource.setPassword("");
  
          return dataSource;
  
      }
  
      @Bean
      public PlatformTransactionManager transactionManager(){
  
          JpaTransactionManager transactionManager = new JpaTransactionManager();
  
          transactionManager.setEntityManagerFactory(
              this.entityManagerFactoryBean().getObject() );
  
          return transactionManager;
  
      }
  
  }
  </code></pre>
  
  <p>I have managed to move the properties of my persistence.xml for the datasource:</p>
  
  <pre><code>&lt;properties&gt;
      ... 
      &lt;property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/&gt;
      &lt;property name="hibernate.hbm2ddl.auto" value="create"/&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p>but how to I set the two remaining hibernate properties above? Thanks</p>