-
May 24th, 2009, 02:59 AM
#1
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" />
-
May 24th, 2009, 04:04 AM
#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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules