Results 1 to 2 of 2

Thread: Connection Pooling with Spring+JPA+hibernate ?

  1. #1
    Join Date
    Nov 2008
    Location
    London,UK
    Posts
    299

    Default 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>
    </property>

    </bean>

    -----------------------------------



    <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 hibernate.properties 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •