【问题标题】:HHH000431: Unable to determine H2 database version, certain features may not workHHH000431:无法确定 H2 数据库版本,某些功能可能无法使用
【发布时间】:2016-11-04 14:25:04
【问题描述】:

我正在 WildFly 10 中运行集成测试,当服务器启动时,出现关于 H2 数据库版本的警告:

HHH000431:无法确定 H2 数据库版本,某些功能可能无法使用。

谁能告诉我如何精确 H2 版本?谢谢。


persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
  <persistence-unit name="jsr352" transaction-type="JTA">
    <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
    <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
    <class>org.hibernate.search.jsr352.test.entity.Company</class>
    <properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
      <property name="hibernate.show_sql" value="false" />
      <property name="hibernate.format_sql" value="false" />
      <property name="hibernate.hbm2ddl.auto" value="create-drop" />
      <property name="hibernate.search.default.directory_provider" value="ram" />
      <property name="hibernate.search.indexing_strategy" value="manual" />
    </properties>
  </persistence-unit>
</persistence>

WF standalone.xml 配置中的子系统数据源。

<subsystem xmlns="urn:jboss:domain:datasources:4.0">
  <datasources>
    <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
      <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
      <driver>h2</driver>
      <security>
        <user-name>sa</user-name>
        <password>sa</password>
      </security>
    </datasource>
    <drivers>
      <driver name="h2" module="com.h2database.h2">
        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
      </driver>
    </drivers>
  </datasources>
</subsystem>

【问题讨论】:

  • WFLY-2325: 这似乎是 WildFly 被拒绝的问题。

标签: java hibernate wildfly h2


【解决方案1】:

当我指定使用org.hibernate.dialect.H2Dialect 时遇到了这个问题,而我实际上是在使用带有驱动程序org.hsqldb.jdbcDriver 的HSQL。更改为使用org.hibernate.dialect.HSQLDialect 后,该消息消失了。

这不是你的情况,你似乎使用 H2 所以也许驱动程序类是错误的?我希望是这样的:

<property name="hibernate.connection.driver_class" value="org.h2.Driver"/>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-08-18
    • 1970-01-01
    • 1970-01-01
    • 2021-09-18
    • 2016-01-01
    • 2020-10-28
    • 1970-01-01
    • 2019-07-14
    相关资源
    最近更新 更多