简体   繁体   中英

How to use c3p0 0.9.2.1 with Hibernate 3.6.10

I see lots of articles that say to upgrade from c3p0 0.9.1 to 0.9.2.1.

Q.1) Is c3p0 0.9.2.1 compatible with Hibernate 3.6.10?

I have this Maven dependency:

<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>3.6.10.Final</version>

When the configuration loads the log reports:

(info) [] Initializing c3p0-0.9.1 [built 16-January-2007 14:46:42;

Tried using these dependencies:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>3.6.10.Final</version>
</dependency>
<dependency>
    <groupId>com.mchange</groupId>
    <artifactId>c3p0</artifactId>
    <version>0.9.2.1</version>
</dependency>

But Hibernate Reports:

628 [main] WARN org.hibernate.connection.ConnectionProviderFactory - c3p0 properties is specificed, but could not find org.hibernate.connection.C3P0ConnectionProvider from the classpath, these properties are going to be ignored.

Q.2) What Maven Dependencies do I need to make Hibernate 3.6.10 work with c3p0 0.9.2.1?

Q.3) Should i be doing it?

Thanks, Steve

you define jar in pom.xml but there is need to implement bean in xml file

 <bean id="MyDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
          destroy-method="close"
          p:driverClass="${app.jdbc.driverClassName}"
          p:jdbcUrl="${app.jdbc.url}"
          p:user="${app.jdbc.username}"
          p:password="${app.jdbc.password}"
          p:acquireIncrement="5"
          p:idleConnectionTestPeriod="60"
          p:maxPoolSize="10000"
          p:maxStatements="50"
          p:minPoolSize="10"/>

No helpful answers posted, but this seems to do the trick:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-c3p0</artifactId>
    <version>3.6.10.Final</version>
    <exclusions>
        <exclusion>
            <groupId>c3p0</groupId>
            <artifactId>c3p0</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>com.mchange</groupId>
    <artifactId>c3p0</artifactId>
    <version>0.9.2.1</version>
</dependency>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM