From 4cebecb8c6635b5cd9019911aec42a3b9909f68a Mon Sep 17 00:00:00 2001 From: Michael O'Brien Date: Mon, 1 Mar 2021 21:38:32 -0500 Subject: [PATCH] #1 - disable db create-drop --- src/main/java/systems/eventstream/field/model/Event.java | 8 ++++++++ .../systems/eventstream/field/service/EventService.java | 6 +++--- src/main/resources/application.properties | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/systems/eventstream/field/model/Event.java b/src/main/java/systems/eventstream/field/model/Event.java index 88a199a..6699448 100644 --- a/src/main/java/systems/eventstream/field/model/Event.java +++ b/src/main/java/systems/eventstream/field/model/Event.java @@ -24,6 +24,14 @@ public class Event { protected Event() {} + public Event(Long timestamp, String value, String label, String type, String category) { + this.timestamp = timestamp; + this.value = value; + this.label = label; + this.type = type; + this.category = category; + } + public Event(Long timestamp, String key, String value, String label, String type, String category) { this.timestamp = timestamp; this.key = key; diff --git a/src/main/java/systems/eventstream/field/service/EventService.java b/src/main/java/systems/eventstream/field/service/EventService.java index f43321a..03cafcf 100644 --- a/src/main/java/systems/eventstream/field/service/EventService.java +++ b/src/main/java/systems/eventstream/field/service/EventService.java @@ -28,15 +28,15 @@ public List events() { @Override public void populate() { // import rows - repository.save(new Event(System.nanoTime(), "1", "4", "new", "off", "category1")); + repository.save(new Event(System.nanoTime(), "4", "new", "off", "category1")); try { Thread.sleep(1); } catch (Exception e) { } - repository.save(new Event(System.nanoTime(), "2", "5", "new", "time", "category2")); + repository.save(new Event(System.nanoTime(), "5", "new", "time", "category2")); try { Thread.sleep(1); } catch (Exception e) { } - repository.save(new Event(System.nanoTime(), "3", "6", "done", "time", "category1")); + repository.save(new Event(System.nanoTime(), "6", "done", "time", "category1")); log.info("Events found with findAll():"); log.info("-------------------------------"); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index ee51355..f394aea 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -25,6 +25,6 @@ spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.h2.console.enabled=true spring.h2.console.path=/h2-console # enable only on first startup -spring.jpa.hibernate.ddl-auto=create-drop - +#spring.jpa.hibernate.ddl-auto=create-drop +#spring.jpa.hibernate.ddl-auto=create spring.jpa.show-sql=true