From ec0f67784b3b18ebc3989e3312cf68354d81d051 Mon Sep 17 00:00:00 2001 From: Seil0 Date: Wed, 15 Jan 2020 20:30:48 +0100 Subject: [PATCH] create database and customer table if it does not exist --- .gitignore | 2 +- .../src/main/java/org/hso/ecommerce/entities/Customer.java | 3 ++- prototype/src/main/resources/application.properties | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index fdf52d7..178b075 100644 --- a/.gitignore +++ b/.gitignore @@ -88,4 +88,4 @@ local.properties *.launch # SQLite -/src/main/resources/*.db +prototype/src/main/resources/*.db diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/Customer.java b/prototype/src/main/java/org/hso/ecommerce/entities/Customer.java index 42e85e2..609259a 100644 --- a/prototype/src/main/java/org/hso/ecommerce/entities/Customer.java +++ b/prototype/src/main/java/org/hso/ecommerce/entities/Customer.java @@ -7,7 +7,8 @@ import javax.persistence.*; public class Customer { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) + @GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "id_Sequence") + @SequenceGenerator(name = "id_Sequence", sequenceName = "ID_SEQ") public Long id; public String lastname; public String firstname; diff --git a/prototype/src/main/resources/application.properties b/prototype/src/main/resources/application.properties index 6ef9ba3..f1ec900 100644 --- a/prototype/src/main/resources/application.properties +++ b/prototype/src/main/resources/application.properties @@ -9,6 +9,7 @@ logging.level.org.springframework.web=INFO spring.datasource.url = jdbc:sqlite:src/main/resources/test.db spring.datasource.driverClassName = org.sqlite.JDBC spring.jpa.properties.hibernate.dialect = org.hso.ecommerce.db.SQLiteDialect +spring.jpa.hibernate.ddl-auto=update # ---------------------------------------- # WEB PROPERTIES