【发布时间】:2019-11-12 10:19:56
【问题描述】:
我正在使用 Spring Boot 的 schema.sql 魔法来创建内存 H2 数据库。该脚本包含以下语句:
create table PERSON
(
ID BIGINT not null primary key,
NAME VARCHAR(255) not null
);
create index IDX_PERSON_NAME on PERSON (NAME);
Spring Boo 启动时失败,出现以下异常:
Caused by: org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #2 of URL [file:/D:/git/.../build/resources/main/schema.sql]: create index IDX_PERSON_NAME on PERSON (NAME); nested exception is org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "PERSON" not found; SQL statement:
create index IDX_PERSON_NAME on PERSON (NAME) [42102-200]
语句怎么找不到前面语句创建的表?
【问题讨论】:
标签: spring spring-boot h2