Hibernate:C3P0属性被忽略

时间:2014-01-20 15:50:20

标签: java hibernate c3p0

我收到以下警告:

15:41:51,043 WARN  [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-1) HHH000022: c3p0 properties were encountered, but the org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider provider class was not found on the classpath; these properties are going to be ignored.

以下是我的Hibernate.xfg.xml中设置的属性:

<property name="hibernate.c3p0.min_size">50</property>
<property name="hibernate.c3p0.max_size">200</property>
... (and other properties)

除了上述属性外,我没有关于C3P0的任何其他配置。

以下是我在Maven pom.xml中配置的所有Hibernate和C3P0依赖项:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>4.2.4.Final</version>
</dependency>

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-validator</artifactId>
    <version>4.3.1.Final</version>
</dependency>

<dependency>
    <groupId>c3p0</groupId>
    <artifactId>c3p0</artifactId>
    <version>0.9.1.2</version>
</dependency>

为了能够读取此时被忽略的属性,我需要做些什么?

1 个答案:

答案 0 :(得分:12)

post开始,您似乎缺少hibernate-c3p0依赖关系

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

您需要将版本与hibernate-core

中使用的版本进行匹配