Announcement Announcement Module
No announcement yet.
Connection Pooling with Spring+JPA+hibernate ? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Connection Pooling with Spring+JPA+hibernate ?

    <bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerE ntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="jpaVendorAdapter">
    <bean class="org.springframework.orm.jpa.vendor.Hibernat eJpaVendorAdapter">
    <property name="database" value="MYSQL" />
    <property name="showSql" value="true" />



    <bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://localhost/<DBNAME>" />
    <property name="username" value="<USER>" /> <property name="password"
    value="<PASSWORD>" /> </bean>


    Above ar ethe definition for my entity manager and my datasource ..

    Now how do i enable connection pooling using c3po ?

    I tried adding with the connection pooling valuse in classpath it didnt pick up .

    Also tried to add the below into my entityManagerFactory ,still it didnt pickup .How can i set cnnection pooling values ?

    <property name="jpaPropertyMap">
    <entry key="hibernate.dialect" value="net.sf.hibernate.dialect.MySQLDialect" />
    <entry key="hibernate.show_sql" value="false" />
    <entry key="hibernate.c3p0.min_size" value="5" />
    <entry key="hibernate.c3p0.max_size" value="10" />
    <entry key="hibernate.c3p0.timeout" value="1800" />
    <entry key="hibernate.c3p0.max_statements" value="50" />

  • #2
    When posting code please use [ code][/code ] tags.

    I suggest you use the search function this question has been answered multiple times. Basically simply configur a ComboPooledDataSource instead of the DriverManagerDataSource.