title: EclipseLink with Spring - Can't persist into Db
body: <p>I am using Spring + EclipseLink 2 to manage entity on a Derby database. Select object from db works fine but when I try to persist one, nothing happens. Program executes correctly and no exception are thrown. I probably did something wrong, as I'm not familiar with Spring, thanks for your comments and suggestions :)</p>
  
  <p>The ServerDaoDb method :</p>
  
  <pre><code>@Transactional
  public void addServer(Server server) {
      EntityManager em = emf.createEntityManager();
      emf.createEntityManager().persist(server);
      em.close();
  }
  </code></pre>
  
  <p>Application context is :</p>
  
  <p></p>
  
  <pre><code> ... 
   &lt;tx:annotation-driven /&gt;
  
      &lt;bean id="entityManagerFactory"
          class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean"&gt;
          &lt;property name="persistenceUnitName" value="SpringPratiquePU" /&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;bean 
  class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /&gt;
  &lt;bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/&gt;
  </code></pre>
  
  <p>Persistence.xml :</p>
  
  <pre><code>  &lt;persistence-unit name="SpringPratiquePU" transaction-type="RESOURCE_LOCAL"&gt;
      &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt;
      &lt;class&gt;net.athom.spring.examples.models.eas.Server&lt;/class&gt;
      &lt;class&gt;net.athom.spring.examples.models.eas.Node&lt;/class&gt;
      &lt;properties&gt;
        &lt;property name="eclipselink.target-database" value="DERBY"/&gt;
        &lt;property name="javax.persistence.jdbc.url" value="jdbc:derby://localhost:1527/SpringPratique"/&gt;
        &lt;property name="javax.persistence.jdbc.password" value="clem"/&gt;
        &lt;property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/&gt;
        &lt;property name="javax.persistence.jdbc.user" value="clem"/&gt;
      &lt;/properties&gt;
    &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>The Debug Trace :</p>
  
  <pre><code>DEBUG JpaTransactionManager:365 - Creating new transaction with name [net.athom.spring.examples.service.impl.ServerManagerImpl.addServer]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; ''
  [EL Info]: 2010-10-29 15:33:27.443--ServerSession(14894886)--EclipseLink, version: Eclipse Persistence Services - 2.0.2.v20100323-r6872
  [EL Info]: 2010-10-29 15:33:28.606--ServerSession(14894886)--file:/C:/netbeanProject/SpringPratique/src/_SpringPratiquePU login successful
  15:33:28,893       DEBUG JpaTransactionManager:323 - Opened new EntityManager [org.eclipse.persistence.internal.jpa.EntityManagerImpl@1779885] for JPA transaction
  15:33:28,951       DEBUG DefaultListableBeanFactory:242 - Returning cached instance of singleton bean 'transactionManager'
  15:33:28,952       DEBUG JpaTransactionManager:286 - Found thread-bound EntityManager [org.eclipse.persistence.internal.jpa.EntityManagerImpl@1779885] for JPA transaction
  15:33:28,953       DEBUG JpaTransactionManager:470 - Participating in existing transaction
  15:33:29,266       DEBUG JpaTransactionManager:752 - Initiating transaction commit
  15:33:29,267       DEBUG JpaTransactionManager:462 - Committing JPA transaction on EntityManager [org.eclipse.persistence.internal.jpa.EntityManagerImpl@1779885]
  15:33:29,268       DEBUG JpaTransactionManager:548 - Closing JPA EntityManager [org.eclipse.persistence.internal.jpa.EntityManagerImpl@1779885] after transaction
  15:33:29,308       DEBUG EntityManagerFactoryUtils:328 - Closing JPA EntityManager
  </code></pre>