H2 = MODE = Oracle会导致'Schema“information_schema”找不到“

时间:2017-07-20 16:52:59

标签: java oracle hibernate spring-boot h2

我正在使用Spring Boot 1.5.4.RELEASE 构建应用程序,我想在 Flyway 中使用 H2

我的 application.properties 是:

spring.datasource.url=jdbc:h2:mem:test;MODE=Oracle;DB_CLOSE_ON_EXIT=FALSE;DATABASE_TO_UPPER=false;AUTO_RECONNECT=TRUE;INIT=create schema if not exists test;
spring.datasource.username=sa
spring.datasource.password=
spring.h2.console.enabled=true
spring.jpa.generate-ddl=false
spring.jpa.hibernate.ddl-auto=validate

flyway.baseline-version=0.0.1
flyway.sql-migration-prefix=Migration-
flyway.table=SCHEMA_HISTORY
flyway.locations=filesystem:src/schema/bundle

我得到的错误是:

Caused by: org.h2.jdbc.JdbcSQLException: Schema "information_schema" not found; SQL statement:
select SEQUENCE_CATALOG, SEQUENCE_SCHEMA, SEQUENCE_NAME, INCREMENT from information_schema.sequences [90079-195]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.message.DbException.get(DbException.java:179) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.message.DbException.get(DbException.java:155) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.command.Parser.getSchema(Parser.java:682) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.command.Parser.getSchema(Parser.java:688) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.command.Parser.readTableFilter(Parser.java:1218) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.command.Parser.parseSelectSimpleFromPart(Parser.java:1940) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.command.Parser.parseSelectSimple(Parser.java:2089) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.command.Parser.parseSelectSub(Parser.java:1934) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.command.Parser.parseSelectUnion(Parser.java:1749) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.command.Parser.parseSelect(Parser.java:1737) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.command.Parser.parsePrepared(Parser.java:448) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.command.Parser.parse(Parser.java:320) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.command.Parser.parse(Parser.java:292) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.command.Parser.prepareCommand(Parser.java:257) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.engine.Session.prepareLocal(Session.java:573) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.engine.Session.prepareCommand(Session.java:514) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1204) ~[h2-1.4.195.jar:1.4.195]
    at org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:74) ~[h2-1.4.195.jar:1.4.195]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60]
    at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114) ~[tomcat-jdbc-8.5.15.jar:na]

spring.jpa.hibernate.ddl-auto 设置为解决了这个问题,但我想让我的模式针对模型进行验证(已经遇到过一个讨厌的bug )。我猜这是正确的方式。我错过了什么?

0 个答案:

没有答案