H2 - Oracle - liquibase - org.h2.jdbc.JdbcSQLException: Table "all_sequences" 未找到;

H2 - Oracle - liquibase - org.h2.jdbc.JdbcSQLException: Table "all_sequences" not found;

我尝试将用于测试目的的 H2 添加到 Spring 启动 application-test.yml,我的生产数据库是 Oracle。我想通过 liquibase 填充 H2 架构,但收到以下错误:

Caused by: org.h2.jdbc.JdbcSQLException: Table "all_sequences" not found; SQL statement:

我的配置如下:

spring:
  profiles:
    active: test
  datasource:
    url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=Oracle
    username: sa
    password:
    platform: h2
    driver-class-name: org.h2.Driver

  jpa:
    hibernate:
      ddl-auto: none
    generate-ddl: true

  h2:
    console:
      enabled: true
      path: /console

liquibase:
  url: ${spring.datasource.url}
  enabled: true
  user: sa
  password:
  change-log: classpath:liquibase/test-master.xml
  drop-first: true

如何调整上面的配置,我花了几个小时,但不知道如何让它工作。

all_sequences 是 Oracle 特定的数据库 table。您应该只迁移用户定义的 tables.

添加:

jpa:
  properties:
    hibernate:
      dialect: org.hibernate.dialect.H2Dialect

问题已解决。

完整配置:

spring:
  datasource:
    url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=Oracle
    username: sa
    password:
    platform: h2
    driver-class-name: org.h2.Driver
  jpa:
    properties:
      hibernate:
        dialect: org.hibernate.dialect.H2Dialect
    hibernate:
      ddl-auto: none
    generate-ddl: true

liquibase:
  url: ${spring.datasource.url}
  contexts: test
  change-log: classpath:liquibase/test-master.xml
  user: sa
  password: