私は簡単なRestfullアプリケーションを持っています。できます。しかし、.sqlファイルを追加すると、アプリケーションが動作しません。 私が最初に実行した後schema.sqlSQLスクリプトを追加すると、Springブートが動作しません
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
CREATE TABLE country (
id SERIAL PRIMARY KEY NOT NULL ,
county_name CHAR (30) NOT NULL UNIQUE);
CREATE TABLE city (
id SERIAL PRIMARY KEY NOT NULL ,
city_name CHAR (30) NOT NULL,
country_id INTEGER REFERENCES country,
UNIQUE (city_name, country_id));
CREATE TABLE street (
id SERIAL PRIMARY KEY NOT NULL,
street_name CHAR (30) NOT NULL,
city_id INTEGER REFERENCES city,
building_number CHAR(10),
UNIQUE (street_name, city_id));
とdata.sqlに
INSERT INTO country (county_name) VALUES ('Ukraine');
INSERT INTO country (county_name) VALUES ('France');
INSERT INTO country (county_name) VALUES ('Italy');
INSERT INTO country (county_name) VALUES ('German');
INSERT INTO country (county_name) VALUES ('England');
application.properties
spring.jpa.database=postgresql
spring.datasource.platform=postgres
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=create-drop
spring.database.driverClassName=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/ubr
spring.datasource.username=postgres
spring.datasource.password=1
server.port=8080
を追加する - それがエラーをしていないが、2番目の実行後にI a stacktrace with many exeptionsがあります。私は間違っている?
私は自分の.propertiesを変更しました: 'spring.jpa.hibernate.ddl-auto = update'; 'spring.datasourse.data =/resources/data.sql' ' spring.datasourse.schema =/resources/schema.sql'; 'spring.datasource.continueOnError = true'となり、動作します。私が正しくやったことや間違ったことは? –