C3p0 with Hibernate 4.2 error: setCharacterStream(ILjava/io/Reader;J)V is abstract
C3p0 with Hibernate 4.2 error: setCharacterStream(ILjava/io/Reader;J)V is abstract
我将 Hibernate 4.2 与 c3p0 一起使用,但出现此错误:Method com/mchange/v2/c3p0/impl/NewProxyPreparedStatement.setCharacterStream(ILjava/io/Reader;J)V is abstract
有人知道我应该使用哪个版本吗?这是我当前的 Maven 依赖项列表:
<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>
PreparedStatement.setCharacterStream() method was added to JDBC 4 and according to C3P0 release notes:
As of version 0.9.5, c3p0 fully supports the jdbc4 spec.
所以你需要update the C3p0 library to 0.9.5:
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5</version>
</dependency>
您还可以从 Hibernate 中排除 C3P0 依赖项,以确保 Maven 使用您明确配置的依赖项:
<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>
使用artifactId c3p0 0.9.5.2就可以了!
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.2</version>
</dependency>
在迁移到休眠 4 之后我不得不添加
c3p0-0.9.5.jar 和 mchange-commons-java-0.2.15.jar(jar , 因为它不是 maven 项目)
我将 Hibernate 4.2 与 c3p0 一起使用,但出现此错误:Method com/mchange/v2/c3p0/impl/NewProxyPreparedStatement.setCharacterStream(ILjava/io/Reader;J)V is abstract
有人知道我应该使用哪个版本吗?这是我当前的 Maven 依赖项列表:
<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>
PreparedStatement.setCharacterStream() method was added to JDBC 4 and according to C3P0 release notes:
As of version 0.9.5, c3p0 fully supports the jdbc4 spec.
所以你需要update the C3p0 library to 0.9.5:
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5</version>
</dependency>
您还可以从 Hibernate 中排除 C3P0 依赖项,以确保 Maven 使用您明确配置的依赖项:
<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>
使用artifactId c3p0 0.9.5.2就可以了!
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.2</version>
</dependency>
在迁移到休眠 4 之后我不得不添加 c3p0-0.9.5.jar 和 mchange-commons-java-0.2.15.jar(jar , 因为它不是 maven 项目)