java - HHH000431 : Unable to determine H2 database version, 某些功能可能无法工作

标签 java hibernate wildfly h2

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

HHH000431: Unable to determine H2 database version, certain features may not work.

谁能告诉我如何精确 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>

最佳答案

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

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

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

关于java - HHH000431 : Unable to determine H2 database version, 某些功能可能无法工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38157862/

相关文章:

java - Hibernate EAGER fetch 和 cascade-type all 有什么区别

java - SLF4J + Logback 不登录 WildFly

java - WildFly LDAP 连接 JNDI

java - Deque 删除不会引发 ConcurrentModificationException

java - 无法使用 SimpleDateFormat 解析 AM/PM

java - 将两个字符串与新行合并

hibernate - 实体类和持久类有什么区别?

java - "Upgrade"从基类到子类的实体

jpa - 如何在 CDI( Weld )中注入(inject) EntityManager?

java - Android NDK 中的某些 C++ 包含文件不起作用