从Hibernate 3.6升级到4.0.1现在会发出有关配置的警告

时间:2012-02-10 14:19:57

标签: hibernate

刚刚从Hibernate 3.6更新到Hibernate 4,现在正在

10-Feb-2012 14:12:31 org.hibernate.dialect.DerbyDialect <init>
WARN: HHH000430: The DerbyDialect dialect has been deprecated; use one of the version-specific dialects instead
10-Feb-2012 14:12:31 org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator c3p0ProviderPresent
WARN: 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.

我改变了

config.setProperty("hibernate.dialect","org.hibernate.dialect.DerbyDialect");

config.setProperty("hibernate.dialect","org.hibernate.dialect.DerbyTenSevenDialect");

我加了

config.setProperty("org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator","org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider");

但它没有区别

我使用maven来配置我的项目,relvent依赖项是

<dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-core</artifactId>
      <version>4.0.1.Final</version>
        <exclusions>
          <exclusion>
            <groupId>javax.transaction</groupId>
            <artifactId>jta</artifactId>
          </exclusion>
        </exclusions>
    </dependency>
    <dependency>
      <groupId>c3p0</groupId>
      <artifactId>c3p0</artifactId>
      <version>0.9.1.2</version>
    </dependency>
    <dependency>
    <groupId>javax.transaction</groupId>
    <artifactId>jta</artifactId>
    <version>1.1</version>
    </dependency>
    <dependency>
      <groupId>javax.persistence</groupId>
      <artifactId>persistence-api</artifactId>
      <version>1.0.2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.derby</groupId>
      <artifactId>derby</artifactId>
      <version>10.8.2.2</version>
    </dependency>
    <dependency>
      <groupId>org.javassist</groupId>
      <artifactId>javassist</artifactId>
      <version>3.15.0-GA</version>
    </dependency>

1 个答案:

答案 0 :(得分:1)

c3po问题是由我的maven配置引起的,c3po的休眠版本和其他软件包现在可以在Hibernate 4中使用,所以我将maven配置为

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

Derby Dialect问题是由于org.hibernate.dialect.DerbyTenSevenDialect类直接将org.hibernate.dialect.DerbyDialect子类化,因此仍然存在问题,因此已经为此提出了jira。 / p>