title: DB Connection are not released while running the Spring+Eclipse Link jpa application
body: <p>Below are persistence.xml configurations.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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="Associateinfo"&gt;
      &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt;
      &lt;class&gt;com.testpackage.associateinfo.model.Associate&lt;/class&gt;
  
  
      &lt;properties&gt;
        &lt;property name="eclipselink.logging.level" value="FINE"/&gt;
        &lt;property name="eclipselink.logging.exceptions" value="true"/&gt;
        &lt;property name="eclipselink.logging.timestamp" value="true" /&gt;
        &lt;property name="eclipselink.logging.session" value="true" /&gt;
        &lt;property name="eclipselink.logging.thread" value="true" /&gt;
        &lt;property name="eclipselink.logging.connection" value="true"/&gt;
  
        &lt;property name="eclipselink.target-database" value="SQLServer" /&gt;
        &lt;property name="eclipselink.ddl-generation.output-mode" value="both"/&gt;
  
        &lt;property name="eclipselink.weaving" value="false"/&gt;
        &lt;property name="eclipselink.flush-clear.cache" value="DropInvalidate"/&gt;
  
  
        &lt;property name="javax.persistence.jdbc.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/&gt;
  
        &lt;property name="javax.persistence.jdbc.url" value="test"/&gt;
        &lt;property name="javax.persistence.jdbc.user" value="uname"/&gt;
        &lt;property name="javax.persistence.jdbc.password" value="pwd"/&gt;
        &lt;property name="eclipselink.logging.connection" value="true"/&gt;
        &lt;property name="eclipselink.cache.size.default" value="20000"/&gt;
        &lt;property name="eclipselink.query-results-cache" value="true"/&gt;
  
      &lt;/properties&gt;
    &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>Spring configurations:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans:beans
      xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:beans="http://www.springframework.org/schema/beans"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:jpa="http://www.springframework.org/schema/data/jpa"
      xmlns:mvc="http://www.springframework.org/schema/mvc"
      xmlns:p="http://www.springframework.org/schema/p"
      xmlns:tx="http://www.springframework.org/schema/tx"
      xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"&gt;
  
      &lt;!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure --&gt;
  
      &lt;!-- Enables the Spring MVC @Controller programming model --&gt;
      &lt;mvc:annotation-driven /&gt;
  
      &lt;!-- Handles HTTP GET requests for /resources/** by efficiently serving up static 
          resources in the ${webappRoot}/resources directory --&gt;
      &lt;mvc:resources
          mapping="/resources/**"
          location="/resources/" /&gt;
  
      &lt;beans:import resource="view.xml" /&gt;
  
      &lt;context:component-scan base-package="com.testpackage.associateinfo" /&gt;
  
      &lt;!-- Application properties --&gt; 
      &lt;bean name="appProperties" 
         class="org.springframework.beans.factory.config.MapFactoryBean"&gt;
         &lt;property name="sourceMap"&gt;
            &lt;map&gt;
               &lt;entry key="useMinifiedScript" value="false" /&gt;
            &lt;/map&gt;
         &lt;/property&gt;
      &lt;/bean&gt;   
  
      &lt;bean
          id="persistenceExceptionInterceptor"
          class="org.springframework.orm.jpa.vendor.EclipseLinkJpaDialect" /&gt;
      &lt;jpa:repositories
          base-package="com.testpackage.associateinfo.dao"
          query-lookup-strategy="use-declared-query" /&gt;
  
      &lt;!-- --&gt;
      &lt;!-- This will ensure that JPA exceptions are automatically translated into Spring's 
          generic DataAccessException hierarchy for those classes annotated with @Repository. --&gt;
      &lt;bean
          class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" /&gt;
  
      &lt;!-- JPA Entity Manager Factory --&gt;
      &lt;bean
          id="entityManagerFactory"
          class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
  
          p:persistenceXmlLocation="classpath:META-INF/persistence.xml"
          p:persistenceUnitName="Associateinfo"&gt;
  
          &lt;property name="persistenceUnitManager"&gt;
           &lt;bean class="org.springframework.data.jpa.support.MergingPersistenceUnitManager" /&gt;
        &lt;/property&gt;
          &lt;property name="jpaPropertyMap"&gt;
              &lt;map&gt;
                  &lt;entry
                      key="eclipselink.weaving"
                      value="false" /&gt;
              &lt;/map&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;!-- bean post-processor for JPA annotations --&gt;
      &lt;bean
          class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /&gt;
  
  
      &lt;!-- Transaction configuration --&gt;
      &lt;bean
          id="transactionManager"
          class="org.springframework.orm.jpa.JpaTransactionManager"
          p:entityManagerFactory-ref="entityManagerFactory" /&gt;
  
      &lt;!-- use declarative transaction management --&gt;
      &lt;tx:annotation-driven transaction-manager="transactionManager" /&gt;
  
  
  
  &lt;/beans:beans&gt;
  </code></pre>
  
  <p>after running this application, after couple of days i have seen db connections are opened at Database side, getting connection close exception at application side which is running in Jboss server.
      Please help me if I have missed any configurations.</p>