title: Spring + Hibernate - Persisting/Committing data doesn't work
body: <p>I'm one on one with the guides code under the section "A post this long must mean a lot of code and configuration".</p>
  
  <p><a href="http://blog.springsource.com/2006/08/07/using-jpa-in-spring-without-referencing-spring/" rel="nofollow">http://blog.springsource.com/2006/08/07/using-jpa-in-spring-without-referencing-spring/</a></p>
  
  <p>The problem is, that only select-like queries work. When i try to persist a bean/entity the query just doesn't happen (i have show sql option set on for Hibernate). I know this is propably something related to springs configuration, but i have no experience on what to look for.</p>
  
  <p>Spring configuration:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;bean id="entityManagerFactory"
      class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean" /&gt;
  
  &lt;bean id="productDaoImpl" class="product.ProductDaoImpl"/&gt;
  
  &lt;bean
      class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /&gt;
  
  &lt;bean 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></p>
  
  <pre><code>Dao:
  
      @Repository
  public class ProductDaoImpl implements ProductDao {
  
      private EntityManager entityManager;
  
      @PersistenceContext
      public void setEntityManager(EntityManager entityManager) {
          this. entityManager = entityManager;
      }
  
      // works
      public Collection loadProductsByCategory(String category) {
          return entityManager.createQuery("from Product p where p.category = :category")
              .setParameter("category", category).getResultList();
      }
  
     // Doesn't even get queried for
     public void persistWhatever(Product product) { entityManger.persist(product); }
  }
  </code></pre>