问题是当我执行我的集成测试时,我得到了异常:
Caused by: org.h2.jdbc.JdbcSQLException: Schema "myschema" already exists; SQL statement:
CREATE SCHEMA myschema [90078-196]
我有这个应用程序-test.yml:
debug: true
spring:
data:
jpa:
repositories:
enabled: true
jpa:
database: h2
generate-ddl: true
show-sql: true
hibernate:
ddl-auto: create-drop
properties:
hibernate.hbm2ddl.auto: create-drop
datasource:
url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=TRUE;DATABASE_TO_UPPER=false;INIT=CREATE SCHEMA IF NOT EXISTS myschema
username: sa
password:
driver-class-name: org.h2.Driver
我在这里缺少什么?
答案 0 :(得分:0)
hbm2ddl设置为create-drop,将其更改为更新将解决您的问题。