java – Hibernate:忽略了C3P0属性

前端之家收集整理的这篇文章主要介绍了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>

我需要做些什么才能读取当前被忽略的属性

解决方法

从这个 post看起来你缺少hibernate-c3p0依赖
<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-c3p0</artifactId>
  <version>4.1.10.Final</version>
</dependency>

您需要将该版本与hibernate-core中使用的版本进行匹配

猜你在找的Java相关文章