本文介绍了带有Hibernate 4.2错误的C3p0:setCharacterStream(ILjava / io / Reader; J)V是抽象的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Hibernate 4.2与c3p0一起使用并且遇到此错误:方法com / mchange / v2 / c3p0 / impl / NewProxyPreparedStatement.setCharacterStream(ILjava / io / Reader; J)V是抽象的

I am using Hibernate 4.2 with c3p0 and I am getting this error:Method com/mchange/v2/c3p0/impl/NewProxyPreparedStatement.setCharacterStream(ILjava/io/Reader;J)V is abstract

谁知道我应该使用哪个版本?这是我当前的Maven依赖项列表:

Anybody knows which version should I use? Here is my current Maven dependencies list:

<dependency>
    <groupId>com.mchange</groupId>
    <artifactId>c3p0</artifactId>
    <version>0.9.2</version>
</dependency>

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


推荐答案

方法已根据C3P0添加到JDBC 4中,:

The PreparedStatement.setCharacterStream() method was added to JDBC 4 and according to C3P0 release notes:

因此,您需要 :

<dependency>
    <groupId>com.mchange</groupId>
    <artifactId>c3p0</artifactId>
    <version>0.9.5</version>
</dependency>

您还可以从Hibernate中排除C3P0依赖项,以确保Maven使用您显式配置的依赖项:

You might also exclude the C3P0 dependency from Hibernate, to make sure Maven uses the one you configured explicitly:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-c3p0</artifactId>
    <version>4.2.0.Final</version>
    <exclusions>
        <exclusion>
            <artifactId>c3p0</artifactId>
            <groupId>c3p0</groupId>
        </exclusion>
    </exclusions>
</dependency>

这篇关于带有Hibernate 4.2错误的C3p0:setCharacterStream(ILjava / io / Reader; J)V是抽象的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 09:30