title: How do I set flush mode to "COMMIT" in my configuration files?
body: <p>I'm using Spring 3.1.1.RELEASE, Hibernate 4.1.0.Final, and JPA 2.0.  Is there a way I can configure Spring transactions to commit after the transactions are executed without Java code?  In other words, I would like to set flush mode to commit in either the application context file, hibernate configuration file, or persistence.xml file.  My Spring transaction service class looks like</p>
  
  <pre><code>@Transactional(rollbackFor = Exception.class)
  @Service
  public class ContractServiceImpl implements ContractService
  {
  
      @Autowired
      private ContractDAO m_contractDao;
  
      public void addContract(Contract contract)
      {
         m_contractDao.create(contract);
      }
  
      ...
  </code></pre>
  
  <p>and my application context is set up like so …</p>
  
  <pre><code>&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:mem:myproject" /&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="jpaVendorAdapter"&gt;
          &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"/&gt;
      &lt;/property&gt;
      &lt;property name="persistenceXmlLocation" value="classpath*:META-INF/test-persistence.xml"/&gt;
      &lt;property name="persistenceUnitName" value="testingDatabase"/&gt;
      &lt;property name="dataSource" ref="dataSource"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="sharedEntityManager" class="org.springframework.orm.jpa.support.SharedEntityManagerBean"&gt;
     &lt;property name="entityManagerFactory" ref="entityManagerFactory"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
      &lt;property name="entityManagerFactory" ref="entityManagerFactory"/&gt;
  &lt;/bean&gt;
  
  &lt;tx:annotation-driven /&gt;
  </code></pre>
  
  <p>My persistence.xml file is</p>
  
  <pre><code>&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="testingDatabase" transaction-type="RESOURCE_LOCAL"&gt;
                  &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
                  &lt;properties&gt;
                          &lt;property name="hibernate.ejb.cfgfile" value="/hsql_hibernate.cfg.xml" /&gt;
          &lt;property name="org.hibernate.FlushMode" value="commit" /&gt;
                  &lt;/properties&gt;
          &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>and my hibernate config file is</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC
  "-//Hibernate/Hibernate Configuration DTD//EN"
  "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  
  &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          &lt;property name="hibernate.connection.pool_size"&gt;1&lt;/property&gt;
          &lt;property name="show_sql"&gt;true&lt;/property&gt;
          &lt;property name="dialect"&gt;org.hibernate.dialect.HSQLDialect&lt;/property&gt;
          &lt;property name="hibernate.hbm2ddl.auto"&gt;create-drop&lt;/property&gt;
  
          &lt;mapping class="org.mainco.subco.sbadmin.domain.Product" /&gt;
          &lt;mapping class="org.mainco.subco.sbadmin.domain.Contract" /&gt;
          &lt;mapping class="org.mainco.subco.organization.domain.Country" /&gt;
          &lt;mapping class="org.mainco.subco.organization.domain.State" /&gt;
          &lt;mapping class="org.mainco.subco.organization.domain.Address" /&gt;
          &lt;mapping class="org.mainco.subco.organization.domain.OrganizationType" /&gt;
          &lt;mapping class="org.mainco.subco.organization.domain.Organization" /&gt;
  
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>