title: Spring JPA entities not saving to database
body: <p>I am facing some issues in Spring JPA. I successfully configured the Spring JPA project and  am able to run the project without having any exception.</p>
  
  <p>I intension to save the entities to the database. But when I am running the project, it is neither saving to the database nor throwing any exceptions.</p>
  
  <p>What could be the problem?  I have added many hiberate related jar files as well because it was throwing exceptions when I run. Now i am not getting any exception. But entities are not saved into database. I have attached my Spring configuration and Java classes.</p>
  
  <p><strong>sprig configuration</strong></p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:p="http://www.springframework.org/schema/p"
          xmlns:tx="http://www.springframework.org/schema/tx"
          xmlns:context="http://www.springframework.org/schema/context"
          xmlns:osgi="http://www.springframework.org/schema/osgi"
          xsi:schemaLocation="
              http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/context
              http://www.springframework.org/schema/context/spring-context.xsd
              http://www.springframework.org/schema/osgi
              http://www.springframework.org/schema/osgi/spring-osgi.xsd
              http://www.springframework.org/schema/tx
              http://www.springframework.org/schema/tx/spring-tx.xsd"&gt; 
  
  
  
      &lt;context:property-placeholder location="classpath:jdbc.properties"/&gt;
  
  
          &lt;!-- Connection Pool --&gt;
       &lt;bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"&gt;
          &lt;property name="driverClass" value="${jdbc.driverClass}"/&gt;
          &lt;property name="jdbcUrl" value="${jdbc.url}"/&gt;
          &lt;property name="user" value="${jdbc.username}"/&gt;
          &lt;property name="password" value="${jdbc.password}"/&gt;
       &lt;/bean&gt;
  
       &lt;!-- JPA EntityManagerFactory --&gt; 
      &lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
              p:dataSource-ref="dataSource"&gt;
          &lt;property name="jpaVendorAdapter"&gt;
              &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"&gt;
                      &lt;property name="database" value="${jdbc.database}"/&gt;
                      &lt;property name="showSql" value="${jdbc.showSql}"/&gt;                  
              &lt;/bean&gt;     
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;!-- Transaction manager for a single JPA EntityManagerFactory (alternative to JTA) --&gt;
      &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
              p:entityManagerFactory-ref="entityManagerFactory"/&gt;
  
  
          &lt;!-- Activates various annotations to be detected in bean classes for eg @Autowired--&gt;
          &lt;context:annotation-config/&gt;
  
        &lt;!-- enable the configuration of transactional behavior based on annotations  --&gt;
        &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;
  
  
  
       &lt;!-- &lt;context:component-scan base-package="com.vemanchery.timesheet.dao"/&gt; --&gt;
      &lt;!-- Implementation Class --&gt;   
      &lt;bean id="employeeDao" class="com.test.dao.impl.EmployeeDao" /&gt;
   &lt;!-- services --&gt;
      &lt;bean id="employeeService" class="com.test.service.impl.EmployeeService" &gt;
          &lt;property name="employeeDao" ref="employeeDao"/&gt;
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>DAO</strong></p>
  
  <pre><code>package com.test.dao.impl;
  
  
  import java.util.List;
  
  import javax.persistence.EntityManager;
  import javax.persistence.PersistenceContext;
  import javax.persistence.Query;
  
  import com.test.dao.interfaces.IEmployeeDao;
  import com.test.model.interfaces.IEmployee;
  
  
  
  //@Repository
  //@Component
  public class EmployeeDao implements IEmployeeDao{
  
      @PersistenceContext()
      private EntityManager entityManager ;
  
      @Override
      public boolean createEmployee(IEmployee employee) {     
          this.entityManager.persist(employee);
  
          return true;
      }
  
  
  }
  </code></pre>
  
  <p><strong>Service Layer</strong></p>
  
  <pre><code>package com.test.service.impl;
  
  import org.springframework.beans.factory.annotation.Autowired;
  
  import com.test.dao.impl.EmployeeDao;
  import com.test.dao.interfaces.IEmployeeDao;
  import com.test.model.interfaces.IEmployee;
  import com.test.service.interfaces.IEmployeeService;
  
  public class EmployeeService implements IEmployeeService{
  
      @Autowired
      IEmployeeDao employeeDao;
  
      public IEmployeeDao getEmployeeDao() {
          return employeeDao;
      }
  
      public void setEmployeeDao(IEmployeeDao employeeDao) {
          this.employeeDao = employeeDao;
      }
  
      /**
       * 
       */
      public boolean addEmployee(IEmployee employee){
          employeeDao.createEmployee(employee);       
          return false;
      }
  
  }
  </code></pre>