Spring configuration of C3P0 with Hibernate?
Posted
by HDave
on Stack Overflow
See other posts from Stack Overflow
or by HDave
Published on 2010-06-09T03:19:19Z
Indexed on
2010/06/09
3:22 UTC
Read the original article
Hit count: 361
I have a Spring/JPA application with Hibernate as the JPA provider. I've configured a C3P0 data source in Spring via:
<bean id="myJdbcDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<!-- Connection properties -->
<property name="driverClass" value="$DS{database.class}" />
<property name="jdbcUrl" value="$DS{database.url}" />
<property name="user" value="$DS{database.username}" />
<property name="password" value="$DS{database.password}" />
<!-- Pool properties -->
<property name="minPoolSize" value="5" />
<property name="maxPoolSize" value="20" />
<property name="maxStatements" value="50" />
<property name="idleConnectionTestPeriod" value="3000" />
<property name="loginTimeout" value="300" />
I then specified this data source in the Spring entity manager factory as follows:
<bean id="myLocalEmf"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="myapp-core" />
<property name="dataSource" ref="myJdbcDataSource" />
</bean>
However, I recently noticed while browsing maven artifacts a "hibernate-c3p0". What is this? Is this something I need to use? Or do I already have this configured properly?
© Stack Overflow or respective owner