简体   繁体   English

如何在Hibernate 3.6.10中使用c3p0 0.9.2.1

[英]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. 我看到很多文章说要从c3p0 0.9.1升级到0.9.2.1。

Q.1) Is c3p0 0.9.2.1 compatible with Hibernate 3.6.10? Q.1)c3p0 0.9.2.1是否与Hibernate 3.6.10兼容?

I have this Maven dependency: 我有这个Maven依赖项:

<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; (信息)[]初始化c3p0-0.9.1 [内置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: 但是Hibernate报告:

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. 628 [main] WARN org.hibernate.connection.ConnectionProviderFactory-c3p0属性是特定的,但无法从类路径中找到org.hibernate.connection.C3P0ConnectionProvider,这些属性将被忽略。

Q.2) What Maven Dependencies do I need to make Hibernate 3.6.10 work with c3p0 0.9.2.1? Q.2)我需要什么Maven依赖关系才能使Hibernate 3.6.10与c3p0 0.9.2.1一起使用?

Q.3) Should i be doing it? Q.3)我应该这样做吗?

Thanks, Steve 谢谢,史蒂夫

you define jar in pom.xml but there is need to implement bean in xml file 您在pom.xml中定义jar,但是需要在xml文件中实现bean

 <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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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