Search code examples
javaspring-bootliquibase

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


I try to add H2 for testing purpose into Spring Boot application-test.yml, my production Db is Oracle. I want to populate H2 schema by liquibase, but I receive following error:

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

My config is following:

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

How to adjust config aboive, I spent few hours, but can not figure out how to make it work.


Solution

  • Adding:

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

    Solved problem.

    Full config:

    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: